diff --git a/booru_viewer/gui/app.py b/booru_viewer/gui/app.py index 6f504e1..d4b86c8 100644 --- a/booru_viewer/gui/app.py +++ b/booru_viewer/gui/app.py @@ -1810,14 +1810,27 @@ def run() -> None: app.setStyle("Fusion") css_text = custom_css.read_text() app.setStyleSheet(css_text) - # Extract selection color from QSS and apply to palette + # Extract colors from QSS and apply to palette for Fusion import re + from PySide6.QtGui import QPalette, QColor + pal = app.palette() m = re.search(r'selection-background-color\s*:\s*(#[0-9a-fA-F]{3,8})', css_text) if m: - from PySide6.QtGui import QPalette, QColor - pal = app.palette() pal.setColor(QPalette.ColorRole.Highlight, QColor(m.group(1))) - app.setPalette(pal) + # Set text color for spinbox/combobox arrows + m = re.search(r'QWidget\s*\{[^}]*?(?:^|\s)color\s*:\s*(#[0-9a-fA-F]{3,8})', css_text, re.MULTILINE) + if m: + text_color = QColor(m.group(1)) + pal.setColor(QPalette.ColorRole.ButtonText, text_color) + pal.setColor(QPalette.ColorRole.WindowText, text_color) + pal.setColor(QPalette.ColorRole.Text, text_color) + m = re.search(r'QWidget\s*\{[^}]*?background-color\s*:\s*(#[0-9a-fA-F]{3,8})', css_text, re.MULTILINE) + if m: + bg_color = QColor(m.group(1)) + pal.setColor(QPalette.ColorRole.Window, bg_color) + pal.setColor(QPalette.ColorRole.Base, bg_color) + pal.setColor(QPalette.ColorRole.Button, bg_color.lighter(120)) + app.setPalette(pal) except Exception as e: log.warning(f"Operation failed: {e}") diff --git a/themes/catppuccin-mocha.qss b/themes/catppuccin-mocha.qss index bb45467..00ae173 100644 --- a/themes/catppuccin-mocha.qss +++ b/themes/catppuccin-mocha.qss @@ -117,12 +117,3 @@ QTabBar::tab:selected { background: #45475a; color: #cba6f7; } - -QSpinBox::up-button, QSpinBox::down-button { - background: #313244; - border: 1px solid #45475a; - width: 16px; -} -QSpinBox::up-button:hover, QSpinBox::down-button:hover { - background: #45475a; -} diff --git a/themes/everforest.qss b/themes/everforest.qss index 71b0a93..aa0aba7 100644 --- a/themes/everforest.qss +++ b/themes/everforest.qss @@ -114,12 +114,3 @@ QTabBar::tab:selected { background: #4f585e; color: #a7c080; } - -QSpinBox::up-button, QSpinBox::down-button { - background: #343f44; - border: 1px solid #4f585e; - width: 16px; -} -QSpinBox::up-button:hover, QSpinBox::down-button:hover { - background: #4f585e; -} diff --git a/themes/gruvbox.qss b/themes/gruvbox.qss index 483491c..6ad7576 100644 --- a/themes/gruvbox.qss +++ b/themes/gruvbox.qss @@ -114,12 +114,3 @@ QTabBar::tab:selected { background: #504945; color: #fe8019; } - -QSpinBox::up-button, QSpinBox::down-button { - background: #3c3836; - border: 1px solid #504945; - width: 16px; -} -QSpinBox::up-button:hover, QSpinBox::down-button:hover { - background: #504945; -} diff --git a/themes/nord.qss b/themes/nord.qss index fa3d2f7..6a9823c 100644 --- a/themes/nord.qss +++ b/themes/nord.qss @@ -117,12 +117,3 @@ QTabBar::tab:selected { color: #88c0d0; border-bottom-color: #88c0d0; } - -QSpinBox::up-button, QSpinBox::down-button { - background: #3b4252; - border: 1px solid #4c566a; - width: 16px; -} -QSpinBox::up-button:hover, QSpinBox::down-button:hover { - background: #434c5e; -} diff --git a/themes/solarized-dark.qss b/themes/solarized-dark.qss index 3cdff77..2ba246a 100644 --- a/themes/solarized-dark.qss +++ b/themes/solarized-dark.qss @@ -114,12 +114,3 @@ QTabBar::tab:selected { background: #586e75; color: #fdf6e3; } - -QSpinBox::up-button, QSpinBox::down-button { - background: #073642; - border: 1px solid #586e75; - width: 16px; -} -QSpinBox::up-button:hover, QSpinBox::down-button:hover { - background: #586e75; -} diff --git a/themes/tokyo-night.qss b/themes/tokyo-night.qss index ed9e246..5ed7858 100644 --- a/themes/tokyo-night.qss +++ b/themes/tokyo-night.qss @@ -114,12 +114,3 @@ QTabBar::tab:selected { background: #3b4261; color: #7aa2f7; } - -QSpinBox::up-button, QSpinBox::down-button { - background: #24283b; - border: 1px solid #3b4261; - width: 16px; -} -QSpinBox::up-button:hover, QSpinBox::down-button:hover { - background: #3b4261; -}