Skip to content

Commit e2b3a2e

Browse files
authored
feat(media): add toggle for album art accent colors (#2831) (#2832)
* fix(media): use system colours in player instead of album cover accent Closes #2831 Removes ColorQuantizer-based album art accent extraction from MediaAccentService. All accent properties now return Theme.primary and Theme.onPrimary directly, so the Dank Dash player always matches the system colour scheme. Blame: ee6f7b4 (introduced MediaAccentService & ColorQuantizer) d799175 (tweaked seekbar accent colours) a62ae33 (further integrated accent into player/album art) c44ffae (monochrome art edge case fixes) * feat(media): add toggle for album art accent colours (#2831) Adds mediaUseAlbumArtAccent setting (default: off) to Settings. When enabled, MediaAccentService extracts accent from album art via ColorQuantizer. When disabled, uses Theme.primary. Toggle is in Settings > Media Player. * fix: use american english spelling (colour -> color) Port 1.5
1 parent 71ab752 commit e2b3a2e

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

quickshell/Common/SettingsData.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ Singleton {
455455
property bool scrollTitleEnabled: true
456456
property bool mediaAdaptiveWidthEnabled: true
457457
property bool audioVisualizerEnabled: true
458+
property bool mediaUseAlbumArtAccent: false
458459
property string audioScrollMode: "volume"
459460
property int audioWheelScrollAmount: 5
460461
property bool audioDeviceScrollVolumeEnabled: false

quickshell/Common/settings/SettingsSpec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ var SPEC = {
185185
scrollTitleEnabled: { def: true },
186186
mediaAdaptiveWidthEnabled: { def: true },
187187
audioVisualizerEnabled: { def: true },
188+
mediaUseAlbumArtAccent: { def: false },
188189
audioScrollMode: { def: "volume" },
189190
audioWheelScrollAmount: { def: 5 },
190191
audioDeviceScrollVolumeEnabled: { def: false },

quickshell/Modules/Settings/MediaPlayerTab.qml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ Item {
6565
onToggled: checked => SettingsData.set("mediaAdaptiveWidthEnabled", checked)
6666
}
6767

68+
SettingsToggleRow {
69+
text: I18n.tr("Use album art accent")
70+
description: I18n.tr("Use colors extracted from album art instead of system theme colors")
71+
checked: SettingsData.mediaUseAlbumArtAccent
72+
onToggled: checked => SettingsData.set("mediaUseAlbumArtAccent", checked)
73+
}
74+
6875
SettingsDropdownRow {
6976
property var scrollOptsInternal: ["volume", "song", "nothing"]
7077
property var scrollOptsDisplay: [I18n.tr("Change Volume", "media scroll wheel option"), I18n.tr("Change Song", "media scroll wheel option"), I18n.tr("Nothing", "media scroll wheel option")]

quickshell/Services/MediaAccentService.qml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ import qs.Services
1111
Singleton {
1212
id: root
1313

14-
readonly property bool hasAccent: _accent !== null
15-
readonly property color accent: _accent !== null ? _accent : Theme.primary
14+
readonly property bool hasAccent: SettingsData.mediaUseAlbumArtAccent ? _accent !== null : true
15+
readonly property color accent: SettingsData.mediaUseAlbumArtAccent && _accent !== null ? _accent : Theme.primary
1616

17-
readonly property color onAccent: {
18-
const c = accent;
19-
const lum = 0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b;
17+
readonly property color onAccent: SettingsData.mediaUseAlbumArtAccent && _accent !== null ? (() => {
18+
const lum = 0.2126 * _accent.r + 0.7152 * _accent.g + 0.0722 * _accent.b;
2019
return lum > 0.6 ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1);
21-
}
20+
})() : Theme.onPrimary
2221

2322
readonly property color accentHover: Theme.withAlpha(accent, 0.12)
2423
readonly property color accentPressed: Theme.withAlpha(accent, Theme.transparentBlurLayers ? 0.24 : 0.16)

0 commit comments

Comments
 (0)