From 2707332ec812f5b9f9a7e7de4e3680d67756d0ce Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Fri, 27 Oct 2023 19:56:22 +0900 Subject: [PATCH] =?UTF-8?q?[Update]=20ColorThemeManager:=20(WIP)Light?= =?UTF-8?q?=E3=83=86=E3=83=BC=E3=83=9E=E9=81=B8=E6=8A=9E=E6=99=82=E3=80=81?= =?UTF-8?q?=E3=82=AB=E3=83=A9=E3=83=BC=E6=8C=87=E5=AE=9A=E3=81=8C=E3=81=AA?= =?UTF-8?q?=E3=81=84=E6=99=82=E3=81=AB=E3=80=81Dark=E3=83=86=E3=83=BC?= =?UTF-8?q?=E3=83=9E=E3=81=A8=E3=83=9E=E3=83=BC=E3=82=B8=E3=81=97=E3=81=A6?= =?UTF-8?q?=E5=80=A4=E3=82=92=E6=8C=81=E3=81=A3=E3=81=A6=E3=81=8F=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vrct_gui/ui_managers/ColorThemeManager.py | 53 ++++++++++++++++++----- vrct_gui/ui_managers/ImageFileManager.py | 3 +- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/vrct_gui/ui_managers/ColorThemeManager.py b/vrct_gui/ui_managers/ColorThemeManager.py index db6b73c1..3b7e330d 100644 --- a/vrct_gui/ui_managers/ColorThemeManager.py +++ b/vrct_gui/ui_managers/ColorThemeManager.py @@ -1,13 +1,8 @@ +import pprint from types import SimpleNamespace class ColorThemeManager(): def __init__(self, theme): - # self.main = SimpleNamespace() - # self.config_window = SimpleNamespace() - # self.selectable_language_window = SimpleNamespace() - # self.main_window_cover = SimpleNamespace() - # self.error_message_window = SimpleNamespace() - # self.confirmation_modal = SimpleNamespace() # old one. But leave it here for now. # self.PRIMARY_100_COLOR = "#c4eac1" @@ -86,13 +81,22 @@ class ColorThemeManager(): self.LIGHT_1000_COLOR = "#010101" + self._createDarkModeColor__Default() if theme == "Dark": - self._createDarkModeColor() - # elif theme == "Light": - # self._createLightModeColor() + pass + + elif theme == "Light": + color = self._createLightModeColor() + for c in color.__dict__.keys(): + s = getattr(self, c) + s_dict = s.__dict__ + data = getattr(color, c) + data_dict = data.__dict__ + + self.mergeNestedDicts(s_dict, data_dict) - def _createDarkModeColor(self): + def _createDarkModeColor__Default(self): self.main = SimpleNamespace( # Common BASIC_TEXT_COLOR = self.LIGHT_100_COLOR, @@ -336,4 +340,31 @@ class ColorThemeManager(): # The color code [#bb4448] is a mixture of [#a9555c] and [#cc3333] (for a redder shade). SB__ERROR_MESSAGE_BG_COLOR = "#bb4448", SB__ERROR_MESSAGE_TEXT_COLOR = "#fff", - ) \ No newline at end of file + ) + + def _createLightModeColor(self): + color = SimpleNamespace( + main = SimpleNamespace( + # Main + MAIN_BG_COLOR = self.DARK_200_COLOR, + ), + + config_window = SimpleNamespace( + # Common + BASIC_TEXT_COLOR = self.LIGHT_100_COLOR, + ), + ) + + return color + + + + @staticmethod + def mergeNestedDicts(d1, d2): + for key, value in d2.items(): + if key in d1 and isinstance(d1[key], dict) and isinstance(value, dict): + mergeNestedDicts(d1[key], value) + else: + d1[key] = value + + return d1 diff --git a/vrct_gui/ui_managers/ImageFileManager.py b/vrct_gui/ui_managers/ImageFileManager.py index 8bb71b4a..2de42c52 100644 --- a/vrct_gui/ui_managers/ImageFileManager.py +++ b/vrct_gui/ui_managers/ImageFileManager.py @@ -3,8 +3,9 @@ from ..ui_utils import getImageFileFromUiUtils class ImageFileManager(): def __init__(self, theme:str ="Dark"): + self._createDarkModeImages() if theme == "Dark": - self._createDarkModeImages() + pass elif theme == "Light": self._createLightModeImages()