v0.31.1: one button look — crisper emboss, darken on hover

- The emboss hugs the edges: thin lit and shaded rims, a defined outline
  that's a touch darker along the bottom, and a nearly flat face — shape
  without depth.
- Hover darkens the whole button slightly instead of Qt's pale panel on
  top of it.
- One face for every button (theme.button_face_qss): regular buttons,
  Library and its ▾, the purple friend-mode buttons, and the transport
  boxes. Shuffle and bpm are boxes that are one button, so the whole box
  darkens (bpm's whole box is now its tap target); the play box's three
  tiles each darken on their own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-28 22:17:05 -07:00
co-authored by Claude Opus 5.5
parent 051312d91d
commit c8c90b830a
6 changed files with 145 additions and 73 deletions
+31 -3
View File
@@ -137,9 +137,37 @@ class TestEmboss:
color = QColor("#808080")
up = theme.emboss_gradient(color)
down = theme.emboss_gradient(color, pressed=True)
light = color.lighter(theme.EMBOSS_LIGHTER).name()
assert up.index(light) < up.index("stop:1")
assert down.index(light) > down.index("stop:1")
rim = color.lighter(theme.EMBOSS_RIM).name()
assert up.startswith(f"qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 {rim}")
assert down.endswith(f"stop:1 {rim})")
def test_crisp_rims_hug_the_edges(self):
"""The shape lives in thin rims, not a wide soft slope."""
gradient = theme.emboss_gradient(QColor("#808080"))
assert f"stop:{theme.EMBOSS_RIM_WIDTH} " in gradient
assert theme.EMBOSS_RIM_WIDTH <= 0.1
assert theme.EMBOSS_RIM > theme.EMBOSS_LIGHTER
def test_hover_darkens_the_whole_button(self):
color = QColor("#c0c0c0")
qss = theme.button_face_qss("QPushButton", color)
hover = qss.split("QPushButton:hover {", 1)[1].split("}", 1)[0]
assert f"stop:0.5 {color.darker(theme.HOVER_DARKER).name()}" in hover
def test_every_button_shares_the_face(self, qapp):
from unittest.mock import MagicMock
from lintunes.gui.sidebar import SidebarPanel
from lintunes.gui.transport import _box_style
from lintunes.gui import cassette_art
manager = MagicMock()
manager.library.playlists = {}
sidebar = SidebarPanel(manager, MagicMock())
for qss in (sidebar.library_button.styleSheet(),
sidebar.friend_button.styleSheet(),
_box_style(QColor("#dddddd"), button=True),
cassette_art.friend_button_qss()):
assert ":hover" in qss
assert "border-bottom-color" in qss
def test_flat_buttons_opt_out(self):
qss = theme.button_emboss_qss(QColor("#808080"))