forked from trav/lintunes
v0.74.1: the version in the status bar follows light/dark mode
It read its color from its own palette, which its stylesheet pins, so the color it got at launch survived every theme switch — pale on pale after going from dark to light.
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
"""LinTunes — iTunes-style music library manager and player for Linux."""
|
||||
|
||||
__version__ = "0.74.0"
|
||||
__version__ = "0.74.1"
|
||||
|
||||
@@ -7,10 +7,9 @@ git pull → the main window restarts the app on `update_applied`.
|
||||
"""
|
||||
|
||||
from PyQt6.QtCore import Qt, QTimer, pyqtSignal
|
||||
from PyQt6.QtGui import QPalette
|
||||
from PyQt6.QtWidgets import QMessageBox, QPushButton
|
||||
|
||||
from lintunes import __version__
|
||||
from lintunes import __version__, theme
|
||||
|
||||
|
||||
class VersionButton(QPushButton):
|
||||
@@ -45,7 +44,9 @@ class VersionButton(QPushButton):
|
||||
def refresh_theme(self):
|
||||
# Subtle but readable: the theme's text color at ~55% opacity
|
||||
# (palette(mid) is too close to the light backgrounds to read).
|
||||
text = self.palette().color(QPalette.ColorRole.WindowText)
|
||||
# From the theme, never self.palette(): this stylesheet pins that,
|
||||
# so the color it gave at launch survived every light/dark switch.
|
||||
text = theme.text_color()
|
||||
self.setStyleSheet(
|
||||
"QPushButton { border: none; padding: 0 6px; "
|
||||
f"color: rgba({text.red()}, {text.green()}, {text.blue()}, 140); }}")
|
||||
|
||||
Reference in New Issue
Block a user