feat(slint): immersive Spectrum bar colors derived from album art (negative fallback)
The bars used a fixed cyan->purple default. Now they take contrast colors from the album artwork, with a negative-fallback for dark covers (a near-black Metallica album would vanish against the black background -> invert so the bars pop). - immersive.rs: spectrum_colors() extracts the most saturated sample as primary + a hue-distinct secondary (channel-rotated if none distinct); if the cover is too dark/desaturated it uses the NEGATIVE of the average. ensure_visible_on_black() inverts a too-dark color and lifts a dim one so both stops read on black. - ImmersiveState gains spectrum-primary / spectrum-secondary (defaults cyan->purple until art resolves); set in playback.rs from the same decoded artwork as glow-color / bg-image. - SpectrumPanel binds the bar gradient to those (base = primary, tip = secondary). cc
This commit is contained in:
4 files changed
+104
-3
No files matched your search
@@ -53,7 +53,7 @@
|
||||
// "Recursion detected" panic.
|
||||
|
||||
import { QualityBadgeFull } from "../primitives/QualityBadgeFull.slint";
|
||||
import { NowPlayingState, VisualizerState } from "../state.slint";
|
||||
import { NowPlayingState, VisualizerState, ImmersiveState } from "../state.slint";
|
||||
|
||||
// One mirrored pair of bars for a single active source bin. Draws the LEFT
|
||||
// column at `x-left` and the RIGHT (mirror) column at `x-right`, both from the
|
||||
@@ -94,7 +94,7 @@ component BarPair inherits Rectangle {
|
||||
y: root.base-y - self.height;
|
||||
// cyan at base -> purple at the tip (Svelte default). If it looks
|
||||
// inverted, swap the two stops.
|
||||
background: @linear-gradient(0deg, #00dcc8 0%, #9632ff 100%);
|
||||
background: @linear-gradient(0deg, ImmersiveState.spectrum-primary 0%, ImmersiveState.spectrum-secondary 100%);
|
||||
}
|
||||
|
||||
// RIGHT (mirror) bar — same source bin.
|
||||
@@ -103,7 +103,7 @@ component BarPair inherits Rectangle {
|
||||
width: root.bar-width;
|
||||
height: root.bar-height;
|
||||
y: root.base-y - self.height;
|
||||
background: @linear-gradient(0deg, #00dcc8 0%, #9632ff 100%);
|
||||
background: @linear-gradient(0deg, ImmersiveState.spectrum-primary 0%, ImmersiveState.spectrum-secondary 100%);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user