Spaces quick settings (#7196)
This commit is contained in:
parent
138f6685d4
commit
9fefeefc8c
10 changed files with 366 additions and 32 deletions
16
src/theme.ts
16
src/theme.ts
|
@ -19,6 +19,7 @@ import { _t } from "./languageHandler";
|
|||
|
||||
import SettingsStore from "./settings/SettingsStore";
|
||||
import ThemeWatcher from "./settings/watchers/ThemeWatcher";
|
||||
import { compare } from "./utils/strings";
|
||||
|
||||
export const DEFAULT_THEME = "light";
|
||||
const HIGH_CONTRAST_THEMES = {
|
||||
|
@ -86,6 +87,21 @@ export function enumerateThemes(): {[key: string]: string} {
|
|||
return Object.assign({}, customThemeNames, BUILTIN_THEMES);
|
||||
}
|
||||
|
||||
interface ITheme {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export function getOrderedThemes(): ITheme[] {
|
||||
const themes = Object.entries(enumerateThemes())
|
||||
.map(p => ({ id: p[0], name: p[1] })) // convert pairs to objects for code readability
|
||||
.filter(p => !isHighContrastTheme(p.id));
|
||||
const builtInThemes = themes.filter(p => !p.id.startsWith("custom-"));
|
||||
const customThemes = themes.filter(p => !builtInThemes.includes(p))
|
||||
.sort((a, b) => compare(a.name, b.name));
|
||||
return [...builtInThemes, ...customThemes];
|
||||
}
|
||||
|
||||
function clearCustomTheme(): void {
|
||||
// remove all css variables, we assume these are there because of the custom theme
|
||||
const inlineStyleProps = Object.values(document.body.style);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue