From e2b3a2e3caaf8dd5c0ff698a95d57ee733224b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=E1=BB=B3nh=20Thi=E1=BB=87n=20L=E1=BB=99c?= Date: Sun, 12 Jul 2026 09:29:35 +0700 Subject: [PATCH] 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: ee6f7b47 (introduced MediaAccentService & ColorQuantizer) d799175c (tweaked seekbar accent colours) a62ae336 (further integrated accent into player/album art) c44ffae7 (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 --- quickshell/Common/SettingsData.qml | 1 + quickshell/Common/settings/SettingsSpec.js | 1 + quickshell/Modules/Settings/MediaPlayerTab.qml | 7 +++++++ quickshell/Services/MediaAccentService.qml | 11 +++++------ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/quickshell/Common/SettingsData.qml b/quickshell/Common/SettingsData.qml index 60f85149c..a7d1e0cd0 100644 --- a/quickshell/Common/SettingsData.qml +++ b/quickshell/Common/SettingsData.qml @@ -455,6 +455,7 @@ Singleton { property bool scrollTitleEnabled: true property bool mediaAdaptiveWidthEnabled: true property bool audioVisualizerEnabled: true + property bool mediaUseAlbumArtAccent: false property string audioScrollMode: "volume" property int audioWheelScrollAmount: 5 property bool audioDeviceScrollVolumeEnabled: false diff --git a/quickshell/Common/settings/SettingsSpec.js b/quickshell/Common/settings/SettingsSpec.js index a53bc6b49..5a533790d 100644 --- a/quickshell/Common/settings/SettingsSpec.js +++ b/quickshell/Common/settings/SettingsSpec.js @@ -185,6 +185,7 @@ var SPEC = { scrollTitleEnabled: { def: true }, mediaAdaptiveWidthEnabled: { def: true }, audioVisualizerEnabled: { def: true }, + mediaUseAlbumArtAccent: { def: false }, audioScrollMode: { def: "volume" }, audioWheelScrollAmount: { def: 5 }, audioDeviceScrollVolumeEnabled: { def: false }, diff --git a/quickshell/Modules/Settings/MediaPlayerTab.qml b/quickshell/Modules/Settings/MediaPlayerTab.qml index 402739f6c..868d0f709 100644 --- a/quickshell/Modules/Settings/MediaPlayerTab.qml +++ b/quickshell/Modules/Settings/MediaPlayerTab.qml @@ -65,6 +65,13 @@ Item { onToggled: checked => SettingsData.set("mediaAdaptiveWidthEnabled", checked) } + SettingsToggleRow { + text: I18n.tr("Use album art accent") + description: I18n.tr("Use colors extracted from album art instead of system theme colors") + checked: SettingsData.mediaUseAlbumArtAccent + onToggled: checked => SettingsData.set("mediaUseAlbumArtAccent", checked) + } + SettingsDropdownRow { property var scrollOptsInternal: ["volume", "song", "nothing"] 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")] diff --git a/quickshell/Services/MediaAccentService.qml b/quickshell/Services/MediaAccentService.qml index 0cbfad38f..695b8be1f 100644 --- a/quickshell/Services/MediaAccentService.qml +++ b/quickshell/Services/MediaAccentService.qml @@ -11,14 +11,13 @@ import qs.Services Singleton { id: root - readonly property bool hasAccent: _accent !== null - readonly property color accent: _accent !== null ? _accent : Theme.primary + readonly property bool hasAccent: SettingsData.mediaUseAlbumArtAccent ? _accent !== null : true + readonly property color accent: SettingsData.mediaUseAlbumArtAccent && _accent !== null ? _accent : Theme.primary - readonly property color onAccent: { - const c = accent; - const lum = 0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b; + readonly property color onAccent: SettingsData.mediaUseAlbumArtAccent && _accent !== null ? (() => { + const lum = 0.2126 * _accent.r + 0.7152 * _accent.g + 0.0722 * _accent.b; return lum > 0.6 ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1); - } + })() : Theme.onPrimary readonly property color accentHover: Theme.withAlpha(accent, 0.12) readonly property color accentPressed: Theme.withAlpha(accent, Theme.transparentBlurLayers ? 0.24 : 0.16)