From c79e8022b9e112443744878cc3f3af85854f5dac Mon Sep 17 00:00:00 2001 From: Restart2008 Date: Sun, 26 Oct 2025 17:01:17 -0700 Subject: [PATCH] feat: Add colorblind mode This commit introduces a colorblind mode for red-green color blindness. - Adds a new color palette with colorblind-friendly colors. - Adds a user setting to toggle colorblind mode. - Modifies the color allocation logic to use the new palette when the setting is enabled. - Adds a button to the settings modal to toggle the feature. --- resources/lang/en.json | 2 ++ src/client/graphics/layers/SettingsModal.ts | 31 ++++++++++++++++++++ src/core/configuration/ColorAllocator.ts | 17 +++++++++-- src/core/configuration/Colors.ts | 5 +++- src/core/configuration/DefaultConfig.ts | 9 ++++-- src/core/configuration/PastelTheme.ts | 32 ++++++++++++++++++--- src/core/configuration/PastelThemeDark.ts | 5 ++++ src/core/game/UserSettings.ts | 8 ++++++ tests/Colors.test.ts | 17 +++++++++-- 9 files changed, 113 insertions(+), 13 deletions(-) diff --git a/resources/lang/en.json b/resources/lang/en.json index c11ce34d9..338cea89a 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -306,6 +306,8 @@ "tab_keybinds": "Keybinds", "dark_mode_label": "Dark Mode", "dark_mode_desc": "Toggle the site’s appearance between light and dark themes", + "user_setting.colorblind_mode_label": "Colorblind Mode", + "user_setting.colorblind_mode_desc": "Adjusts colors for red-green color blindness.", "emojis_label": "Emojis", "emojis_desc": "Toggle whether emojis are shown in game", "alert_frame_label": "Alert Frame", diff --git a/src/client/graphics/layers/SettingsModal.ts b/src/client/graphics/layers/SettingsModal.ts index 3956204f0..38c3837fa 100644 --- a/src/client/graphics/layers/SettingsModal.ts +++ b/src/client/graphics/layers/SettingsModal.ts @@ -136,6 +136,12 @@ export class SettingsModal extends LitElement implements Layer { this.requestUpdate(); } + private onToggleColorblindModeButtonClick() { + this.userSettings.toggleColorblindMode(); + this.eventBus.emit(new RefreshGraphicsEvent()); + this.requestUpdate(); + } + private onToggleRandomNameModeButtonClick() { this.userSettings.toggleRandomName(); this.requestUpdate(); @@ -321,6 +327,31 @@ export class SettingsModal extends LitElement implements Layer { + +