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[] {
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 [
{
label: "Themes",
submenu: [
{ label: "Default Dark", click: () => this.setTerminalTheme("default") },
{ label: "Dracula", click: () => this.setTerminalTheme("dracula") },
{ label: "Campbell", click: () => this.setTerminalTheme("campbell") },
],
submenu: submenu,
},
];
}

View File

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

View File

@ -1,5 +1,7 @@
{
"default-dark": {
"display:name": "Default Dark",
"display:order": 1,
"black": "#757575",
"red": "#cc685c",
"green": "#76c266",
@ -24,6 +26,8 @@
"cursorAccent": ""
},
"dracula": {
"display:name": "Dracula",
"display:order": 2,
"black": "#21222C",
"red": "#FF5555",
"green": "#50FA7B",
@ -47,7 +51,35 @@
"background": "#282a36",
"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": {
"display:name": "Campbell",
"display:order": 4,
"black": "#0C0C0C",
"red": "#C50F1F",
"green": "#13A10E",

View File

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