feat: add an option to colour the UI from the playing track's cover
A new Settings section in the sidebar turns it on and off. It is saved in settings.toml, apart from the login, so logging out keeps it. Each theme colour keeps the lightness it has in the brand palette and only takes the cover's dominant hue, so text stays readable on any cover. Covers with too little colour, and nothing playing, use the brand palette. Slint cannot animate a global, so a timer in Rust fades the Theme colours to the new palette over 800 ms.
This commit is contained in:
+20
-15
@@ -46,21 +46,27 @@ export struct Hint { key: string, label: string }
|
||||
|
||||
export global Theme {
|
||||
in-out property <float> s: 1.0;
|
||||
// Warm darks and cream text, from the logo's maroon (#5a0712) and cream.
|
||||
out property <color> bg: #140b0c;
|
||||
out property <color> panel: #1d1012;
|
||||
out property <color> raised: #2b181b;
|
||||
out property <color> line: #42272b;
|
||||
out property <color> text: #faebda;
|
||||
out property <color> muted: #bea999;
|
||||
out property <color> faint: #80685f;
|
||||
// The brand palette: warm darks and cream text, from the logo's maroon
|
||||
// (#5a0712) and cream. The app replaces these with colours from the album
|
||||
// art when that setting is on; src/palette.rs must keep the same defaults.
|
||||
in-out property <color> bg: #140b0c;
|
||||
in-out property <color> panel: #1d1012;
|
||||
in-out property <color> raised: #2b181b;
|
||||
in-out property <color> line: #42272b;
|
||||
in-out property <color> text: #faebda;
|
||||
in-out property <color> muted: #bea999;
|
||||
in-out property <color> faint: #80685f;
|
||||
// Filled surfaces: the current section, buttons, the playing badge.
|
||||
out property <color> accent: #a51d2d;
|
||||
out property <color> on-accent: #faebda;
|
||||
in-out property <color> accent: #a51d2d;
|
||||
in-out property <color> on-accent: #faebda;
|
||||
// Accent for text and thin lines, where the fill colour is too dark to read.
|
||||
out property <color> highlight: #e8757b;
|
||||
in-out property <color> highlight: #e8757b;
|
||||
// Ring around whatever has focus.
|
||||
out property <color> focus: #faebda;
|
||||
in-out property <color> focus: #faebda;
|
||||
// Tops of the sidebar and login backgrounds.
|
||||
in-out property <color> glow: #2a0b11;
|
||||
in-out property <color> login-glow: #3a0b13;
|
||||
// Not part of the palette: errors stay red whatever the album art.
|
||||
out property <color> error: #f0605d;
|
||||
out property <string> serif: "Noto Serif";
|
||||
}
|
||||
@@ -382,8 +388,7 @@ component Sidebar inherits Rectangle {
|
||||
in property <string> footer;
|
||||
callback clicked(int);
|
||||
|
||||
// A hint of the logo's maroon at the top, fading into the panel.
|
||||
background: @linear-gradient(180deg, #2a0b11 0%, Theme.panel 55%);
|
||||
background: @linear-gradient(180deg, Theme.glow 0%, Theme.panel 55%);
|
||||
|
||||
VerticalLayout {
|
||||
padding: 26px * Theme.s;
|
||||
@@ -653,7 +658,7 @@ component LoginView inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
background: @radial-gradient(circle, #3a0b13 0%, Theme.bg 70%);
|
||||
background: @radial-gradient(circle, Theme.login-glow 0%, Theme.bg 70%);
|
||||
|
||||
Rectangle {
|
||||
width: min(560px * Theme.s, parent.width - 40px * Theme.s);
|
||||
|
||||
Reference in New Issue
Block a user