Framework for custom theme

This commit is contained in:
nickofolas
2022-01-29 19:27:49 -06:00
committed by nickofolas
parent 4b521b2845
commit ec0f20b14f
2 changed files with 191 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import { defaultStyles } from "../Themes/Styles";
import { WordWrapOptions } from "../ScriptEditor/ui/Options";
import { OverviewSettings } from "../ui/React/Overview";
import { IStyleSettings } from "../ScriptEditor/NetscriptDefinitions";
import { defaultMonacoTheme, IScriptEditorTheme } from "../ScriptEditor/ui/themes";
/**
* Represents the default settings the player could customize.
@@ -157,6 +158,11 @@ interface IDefaultSettings {
* If the game's sidebar is opened
*/
IsSidebarOpened: boolean;
/**
* Script editor theme data
*/
EditorTheme: IScriptEditorTheme;
}
/**
@@ -216,6 +222,8 @@ export const defaultSettings: IDefaultSettings = {
theme: defaultTheme,
styles: defaultStyles,
overview: { x: 0, y: 0, opened: true },
EditorTheme: defaultMonacoTheme,
};
/**
@@ -258,10 +266,11 @@ export const Settings: ISettings & ISelfInitializer & ISelfLoading = {
MonacoFontSize: 20,
MonacoVim: false,
MonacoWordWrap: "off",
theme: { ...defaultTheme },
styles: { ...defaultStyles },
overview: defaultSettings.overview,
EditorTheme: { ...defaultMonacoTheme },
init() {
Object.assign(Settings, defaultSettings);
},
@@ -273,6 +282,8 @@ export const Settings: ISettings & ISelfInitializer & ISelfLoading = {
delete save.styles;
Object.assign(Settings.overview, save.overview);
delete save.overview;
Object.assign(Settings.EditorTheme, save.EditorTheme);
delete save.EditorTheme;
Object.assign(Settings, save);
},
};