diff --git a/angrmanagement/ui/dialogs/preferences.py b/angrmanagement/ui/dialogs/preferences.py index 6096b5c0f..e60aba63d 100644 --- a/angrmanagement/ui/dialogs/preferences.py +++ b/angrmanagement/ui/dialogs/preferences.py @@ -2,8 +2,9 @@ from PySide6.QtWidgets import QDialog, QVBoxLayout, QHBoxLayout, QListWidget, QListView, QStackedWidget, QWidget, \ QGroupBox, QLabel, QCheckBox, QPushButton, QLineEdit, QListWidgetItem, QScrollArea, QFrame, QComboBox, \ QSizePolicy, QDialogButtonBox -from PySide6.QtCore import QSize +from PySide6.QtCore import QSize +from darkdetect import isDark from ..widgets.qcolor_option import QColorOption from ...config.config_manager import ENTRIES from ...config.color_schemes import COLOR_SCHEMES @@ -143,9 +144,13 @@ def _init_widgets(self): self.setLayout(page_layout) def _load_color_scheme(self, name): - for prop, value in COLOR_SCHEMES[name].items(): - row = self._to_save[prop][1] - row.set_color(value) + if name in COLOR_SCHEMES: + for prop, value in COLOR_SCHEMES[name].items(): + row = self._to_save[prop][1] + row.set_color(value) + else: + name = "Dark" if isDark() else "Light" + self._load_color_scheme(name) def _on_load_scheme_clicked(self): self._load_color_scheme(self._schemes_combo.currentText()) diff --git a/setup.cfg b/setup.cfg index a52c11ee0..b1e25aec0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -26,6 +26,7 @@ install_requires = pyqodeng >= 0.0.6 qtterm getmac + darkdetect QtAwesome pyobjc-framework-Cocoa; platform_system == "Darwin"