mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-05 14:42:07 +00:00
Feature/Move theme system from core to client-side ThemeProvider (#4108)
**Add approved & assigned issue number here:** Resolves #2549 ## Description: Themes are purely for the client's rendering, and the server doesn't need context on them. This PR moves `Theme.ts` from `src/core/configuration` to `src/client/theme` and moves affiliation colors to `render-settings.json`. This is to support the ability to add additional themes more quickly, such as colorblind-friendly themes. No visible changes occur from this refactor. ## Please complete the following: - [X] I have added screenshots for all UI updates - [X] I process any text displayed to the user through translateText() and I've added it to the en.json file - [X] I have added relevant tests to the test directory ## Please put your Discord username so you can be contacted if a bug or regression is found: jetaviz --------- Co-authored-by: Josh Harris <josh@wickedsick.com>
This commit is contained in:
@@ -21,9 +21,6 @@ import { UserSettings } from "../game/UserSettings";
|
||||
import { GameConfig, TeamCountConfig } from "../Schemas";
|
||||
import { NukeType } from "../StatsSchemas";
|
||||
import { assertNever, sigmoid, toInt, within } from "../Util";
|
||||
import { PastelTheme } from "./PastelTheme";
|
||||
import { PastelThemeDark } from "./PastelThemeDark";
|
||||
import { Theme } from "./Theme";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
@@ -84,8 +81,6 @@ export const JwksSchema = z.object({
|
||||
export const SAM_CONSTRUCTION_TICKS = 30 * 10;
|
||||
|
||||
export class Config {
|
||||
private pastelTheme: PastelTheme = new PastelTheme();
|
||||
private pastelThemeDark: PastelThemeDark = new PastelThemeDark();
|
||||
private unitInfoCache = new Map<UnitType, UnitInfo>();
|
||||
constructor(
|
||||
private _gameConfig: GameConfig,
|
||||
@@ -562,11 +557,6 @@ export class Config {
|
||||
numBots(): number {
|
||||
return this.bots();
|
||||
}
|
||||
theme(): Theme {
|
||||
return this.userSettings()?.darkMode()
|
||||
? this.pastelThemeDark
|
||||
: this.pastelTheme;
|
||||
}
|
||||
|
||||
attackLogic(
|
||||
gm: Game,
|
||||
|
||||
Reference in New Issue
Block a user