diff --git a/src/Settings/Settings.ts b/src/Settings/Settings.ts
index 8a4cbdd31..a1cc7d006 100644
--- a/src/Settings/Settings.ts
+++ b/src/Settings/Settings.ts
@@ -1,5 +1,6 @@
import { ISelfInitializer, ISelfLoading } from "../types";
import { OwnedAugmentationsOrderSetting, PurchaseAugmentationsOrderSetting } from "./SettingEnums";
+import { defaultTheme, ITheme } from "./Themes";
/**
* Represents the default settings the player could customize.
@@ -111,42 +112,7 @@ interface IDefaultSettings {
/*
* Theme colors
*/
- theme: {
- [key: string]: string | undefined;
- primarylight: string;
- primary: string;
- primarydark: string;
- successlight: string;
- success: string;
- successdark: string;
- errorlight: string;
- error: string;
- errordark: string;
- secondarylight: string;
- secondary: string;
- secondarydark: string;
- warninglight: string;
- warning: string;
- warningdark: string;
- infolight: string;
- info: string;
- infodark: string;
- welllight: string;
- well: string;
- white: string;
- black: string;
- hp: string;
- money: string;
- hack: string;
- combat: string;
- cha: string;
- int: string;
- rep: string;
- disabled: string;
- backgroundprimary: string;
- backgroundsecondary: string;
- button: string;
- };
+ theme: ITheme;
}
/**
@@ -193,41 +159,7 @@ export const defaultSettings: IDefaultSettings = {
SuppressTIXPopup: false,
SuppressSavedGameToast: false,
- theme: {
- primarylight: "#0f0",
- primary: "#0c0",
- primarydark: "#090",
- successlight: "#0f0",
- success: "#0c0",
- successdark: "#090",
- errorlight: "#f00",
- error: "#c00",
- errordark: "#900",
- secondarylight: "#AAA",
- secondary: "#888",
- secondarydark: "#666",
- warninglight: "#ff0",
- warning: "#cc0",
- warningdark: "#990",
- infolight: "#69f",
- info: "#36c",
- infodark: "#039",
- welllight: "#444",
- well: "#222",
- white: "#fff",
- black: "#000",
- hp: "#dd3434",
- money: "#ffd700",
- hack: "#adff2f",
- combat: "#faffdf",
- cha: "#a671d1",
- int: "#6495ed",
- rep: "#faffdf",
- disabled: "#66cfbc",
- backgroundprimary: "#000",
- backgroundsecondary: "#000",
- button: "#333",
- },
+ theme: defaultTheme,
};
/**
@@ -262,41 +194,7 @@ export const Settings: ISettings & ISelfInitializer & ISelfLoading = {
MonacoInsertSpaces: false,
MonacoFontSize: 20,
- theme: {
- primarylight: defaultSettings.theme.primarylight,
- primary: defaultSettings.theme.primary,
- primarydark: defaultSettings.theme.primarydark,
- successlight: defaultSettings.theme.successlight,
- success: defaultSettings.theme.success,
- successdark: defaultSettings.theme.successdark,
- errorlight: defaultSettings.theme.errorlight,
- error: defaultSettings.theme.error,
- errordark: defaultSettings.theme.errordark,
- secondarylight: defaultSettings.theme.secondarylight,
- secondary: defaultSettings.theme.secondary,
- secondarydark: defaultSettings.theme.secondarydark,
- warninglight: defaultSettings.theme.warninglight,
- warning: defaultSettings.theme.warning,
- warningdark: defaultSettings.theme.warningdark,
- infolight: defaultSettings.theme.infolight,
- info: defaultSettings.theme.info,
- infodark: defaultSettings.theme.infodark,
- welllight: defaultSettings.theme.welllight,
- well: defaultSettings.theme.well,
- white: defaultSettings.theme.white,
- black: defaultSettings.theme.black,
- hp: defaultSettings.theme.hp,
- money: defaultSettings.theme.money,
- hack: defaultSettings.theme.hack,
- combat: defaultSettings.theme.combat,
- cha: defaultSettings.theme.cha,
- int: defaultSettings.theme.int,
- rep: defaultSettings.theme.rep,
- disabled: defaultSettings.theme.disabled,
- backgroundprimary: defaultSettings.theme.backgroundprimary,
- backgroundsecondary: defaultSettings.theme.backgroundsecondary,
- button: defaultSettings.theme.button,
- },
+ theme: { ...defaultTheme },
init() {
Object.assign(Settings, defaultSettings);
},
diff --git a/src/Settings/Themes.ts b/src/Settings/Themes.ts
new file mode 100644
index 000000000..a67ac4bd7
--- /dev/null
+++ b/src/Settings/Themes.ts
@@ -0,0 +1,110 @@
+export interface ITheme {
+ [key: string]: string | undefined;
+ primarylight: string;
+ primary: string;
+ primarydark: string;
+ successlight: string;
+ success: string;
+ successdark: string;
+ errorlight: string;
+ error: string;
+ errordark: string;
+ secondarylight: string;
+ secondary: string;
+ secondarydark: string;
+ warninglight: string;
+ warning: string;
+ warningdark: string;
+ infolight: string;
+ info: string;
+ infodark: string;
+ welllight: string;
+ well: string;
+ white: string;
+ black: string;
+ hp: string;
+ money: string;
+ hack: string;
+ combat: string;
+ cha: string;
+ int: string;
+ rep: string;
+ disabled: string;
+ backgroundprimary: string;
+ backgroundsecondary: string;
+ button: string;
+}
+
+export const defaultTheme: ITheme = {
+ primarylight: "#0f0",
+ primary: "#0c0",
+ primarydark: "#090",
+ successlight: "#0f0",
+ success: "#0c0",
+ successdark: "#090",
+ errorlight: "#f00",
+ error: "#c00",
+ errordark: "#900",
+ secondarylight: "#AAA",
+ secondary: "#888",
+ secondarydark: "#666",
+ warninglight: "#ff0",
+ warning: "#cc0",
+ warningdark: "#990",
+ infolight: "#69f",
+ info: "#36c",
+ infodark: "#039",
+ welllight: "#444",
+ well: "#222",
+ white: "#fff",
+ black: "#000",
+ hp: "#dd3434",
+ money: "#ffd700",
+ hack: "#adff2f",
+ combat: "#faffdf",
+ cha: "#a671d1",
+ int: "#6495ed",
+ rep: "#faffdf",
+ disabled: "#66cfbc",
+ backgroundprimary: "#000",
+ backgroundsecondary: "#000",
+ button: "#333",
+};
+
+export interface IPredefinedThemes {
+ 'Default': ITheme;
+ 'Monokai': ITheme;
+}
+
+export const getPredefinedThemes = (): IPredefinedThemes => ({
+ 'Default': defaultTheme,
+ 'Monokai': {
+ ...defaultTheme,
+
+ backgroundprimary: '#272822',
+ backgroundsecondary: '#1B1C18',
+ primary: '#F8F8F2',
+ primarylight: '#FFF',
+ primarydark: '#FAFAEB',
+ success: '#A6E22E',
+ successlight: '#ADE146',
+ successdark: '#98E104',
+ error: '#F92672',
+ errorlight: '#FF69A0',
+ errordark: '#D10F56',
+ warning: '#E6DB74',
+ warninglight: '#E1D992',
+ warningdark: '#EDDD54',
+ info: '#66D9EF',
+ infolight: '#92E1F1',
+ infodark: '#31CDED',
+
+ hp: '#F92672',
+ money: '#E6DB74',
+ hack: '#A6E22E',
+ combat: '#75715E',
+ cha: '#AE81FF',
+ int: '#66D9EF',
+ rep: '#E69F66',
+ }
+});
diff --git a/src/ui/React/ThemeEditorModal.tsx b/src/ui/React/ThemeEditorModal.tsx
index b8b1f204d..6582ea377 100644
--- a/src/ui/React/ThemeEditorModal.tsx
+++ b/src/ui/React/ThemeEditorModal.tsx
@@ -7,9 +7,11 @@ import Paper from "@mui/material/Paper";
import TextField from "@mui/material/TextField";
import IconButton from "@mui/material/IconButton";
import ReplyIcon from "@mui/icons-material/Reply";
+import PaletteSharpIcon from "@mui/icons-material/PaletteSharp";
import { Color, ColorPicker } from "material-ui-color";
import { ThemeEvents } from "./Theme";
import { Settings, defaultSettings } from "../../Settings/Settings";
+import { ITheme, getPredefinedThemes } from "../../Settings/Themes";
interface IProps {
open: boolean;
@@ -64,11 +66,18 @@ export function ThemeEditorModal(props: IProps): React.ReactElement {
...Settings.theme,
});
- function resetTheme(): void {
- setCustomTheme({
- ...defaultSettings.theme,
- });
- Object.assign(Settings.theme, defaultSettings.theme);
+ const predefinedThemes = getPredefinedThemes();
+ const themes = predefinedThemes && Object.entries(predefinedThemes)
+ .map(([name, templateTheme]) => (
+
+ )) || <>>;
+
+ function setTheme(theme: ITheme): void {
+ setCustomTheme(theme);
+ Object.assign(Settings.theme, theme);
ThemeEvents.emit();
}
@@ -96,250 +105,262 @@ export function ThemeEditorModal(props: IProps): React.ReactElement {
ThemeEvents.emit();
}
+ function setTemplateTheme(theme: ITheme): void {
+ setTheme(theme);
+ }
+
return (
-
- Example tooltip}>
-
-
-
-
-
-
-
- text with primary color
- text with secondary color
- text with error color
-
+
+ Example tooltip}>
+
+
+
+
+
+
+
+
+
+ text with primary color
+ text with secondary color
+ text with error color
+
+
+
-
-
-
-
-
+
+
+
+
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ),
- }}
- />
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <>
+ Copy the string above if you want to backup or share your theme with others.
+ Use the buttons below to replace the current theme with a pre-built template
+ {themes}
+ >
+
);
}