add monokai, make themes more generic -- display:name/display:order

This commit is contained in:
sawka 2024-08-29 21:35:22 -07:00
parent 934d7247db
commit 945c63a3e5
4 changed files with 71 additions and 27 deletions

View File

@ -169,14 +169,22 @@ class TermViewModel {
} }
getSettingsMenuItems(): ContextMenuItem[] { getSettingsMenuItems(): ContextMenuItem[] {
const fullConfig = globalStore.get(atoms.fullConfigAtom);
const termThemes = fullConfig?.termthemes ?? {};
const termThemeKeys = Object.keys(termThemes);
termThemeKeys.sort((a, b) => {
return termThemes[a]["display:order"] - termThemes[b]["display:order"];
});
const submenu: ContextMenuItem[] = termThemeKeys.map((themeName) => {
return {
label: termThemes[themeName]["display:name"] ?? themeName,
click: () => this.setTerminalTheme(themeName),
};
});
return [ return [
{ {
label: "Themes", label: "Themes",
submenu: [ submenu: submenu,
{ label: "Default Dark", click: () => this.setTerminalTheme("default") },
{ label: "Dracula", click: () => this.setTerminalTheme("dracula") },
{ label: "Campbell", click: () => this.setTerminalTheme("campbell") },
],
}, },
]; ];
} }

View File

@ -438,6 +438,8 @@ declare global {
// wconfig.TermThemeType // wconfig.TermThemeType
type TermThemeType = { type TermThemeType = {
"display:name": string;
"display:order": number;
black: string; black: string;
red: string; red: string;
green: string; green: string;

View File

@ -1,5 +1,7 @@
{ {
"default-dark": { "default-dark": {
"display:name": "Default Dark",
"display:order": 1,
"black": "#757575", "black": "#757575",
"red": "#cc685c", "red": "#cc685c",
"green": "#76c266", "green": "#76c266",
@ -24,6 +26,8 @@
"cursorAccent": "" "cursorAccent": ""
}, },
"dracula": { "dracula": {
"display:name": "Dracula",
"display:order": 2,
"black": "#21222C", "black": "#21222C",
"red": "#FF5555", "red": "#FF5555",
"green": "#50FA7B", "green": "#50FA7B",
@ -47,7 +51,35 @@
"background": "#282a36", "background": "#282a36",
"cursorAccent": "#f8f8f2" "cursorAccent": "#f8f8f2"
}, },
"monokai": {
"display:name": "Monokai",
"display:order": 3,
"black": "#1B1D1E",
"red": "#F92672",
"green": "#A6E22E",
"yellow": "#E6DB74",
"blue": "#66D9EF",
"magenta": "#AE81FF",
"cyan": "#A1EFE4",
"white": "#F8F8F2",
"brightBlack": "#75715E",
"brightRed": "#FD5FF1",
"brightGreen": "#A6E22E",
"brightYellow": "#E6DB74",
"brightBlue": "#66D9EF",
"brightMagenta": "#AE81FF",
"brightCyan": "#A1EFE4",
"brightWhite": "#F9F8F5",
"gray": "#75715E",
"cmdtext": "#F8F8F2",
"foreground": "#F8F8F2",
"selectionBackground": "#49483E",
"background": "#272822",
"cursorAccent": "#F8F8F2"
},
"campbell": { "campbell": {
"display:name": "Campbell",
"display:order": 4,
"black": "#0C0C0C", "black": "#0C0C0C",
"red": "#C50F1F", "red": "#C50F1F",
"green": "#13A10E", "green": "#13A10E",

View File

@ -302,26 +302,28 @@ type MimeTypeConfigType struct {
} }
type TermThemeType struct { type TermThemeType struct {
Black string `json:"black"` DisplayName string `json:"display:name"`
Red string `json:"red"` DisplayOrder float64 `json:"display:order"`
Green string `json:"green"` Black string `json:"black"`
Yellow string `json:"yellow"` Red string `json:"red"`
Blue string `json:"blue"` Green string `json:"green"`
Magenta string `json:"magenta"` Yellow string `json:"yellow"`
Cyan string `json:"cyan"` Blue string `json:"blue"`
White string `json:"white"` Magenta string `json:"magenta"`
BrightBlack string `json:"brightBlack"` Cyan string `json:"cyan"`
BrightRed string `json:"brightRed"` White string `json:"white"`
BrightGreen string `json:"brightGreen"` BrightBlack string `json:"brightBlack"`
BrightYellow string `json:"brightYellow"` BrightRed string `json:"brightRed"`
BrightBlue string `json:"brightBlue"` BrightGreen string `json:"brightGreen"`
BrightMagenta string `json:"brightMagenta"` BrightYellow string `json:"brightYellow"`
BrightCyan string `json:"brightCyan"` BrightBlue string `json:"brightBlue"`
BrightWhite string `json:"brightWhite"` BrightMagenta string `json:"brightMagenta"`
Gray string `json:"gray"` BrightCyan string `json:"brightCyan"`
CmdText string `json:"cmdtext"` BrightWhite string `json:"brightWhite"`
Foreground string `json:"foreground"` Gray string `json:"gray"`
SelectionBackground string `json:"selectionBackground"` CmdText string `json:"cmdtext"`
Background string `json:"background"` Foreground string `json:"foreground"`
CursorAccent string `json:"cursorAccent"` SelectionBackground string `json:"selectionBackground"`
Background string `json:"background"`
CursorAccent string `json:"cursorAccent"`
} }