feat(lyrics): add customizable colors

This commit is contained in:
h465855hgg
2026-07-17 14:49:39 +08:00
parent 9eb6984031
commit 6b96da5a0c
4 changed files with 33 additions and 7 deletions
+2
View File
@@ -70,6 +70,8 @@ Plugin settings:
| `show_artist` | `bool` | `true` | Includes the artist in track-information mode. |
| `hide_when_paused` | `bool` | `false` | Hides the widget instead of dimming it while paused. |
| `show_cover` | `bool` | `true` | Shows circular album artwork beside the lyrics. |
| `active_color` | `color` | `primary` | Colors the current and already-sung lyric characters. |
| `inactive_color` | `color` | `on_surface_variant` | Colors upcoming lyrics, paused playback, and secondary lines. |
## IPC
+8 -6
View File
@@ -8,6 +8,8 @@ local showArtist = noctalia.getConfig("show_artist")
local hideWhenPaused = noctalia.getConfig("hide_when_paused")
local showCover = noctalia.getConfig("show_cover")
if showCover == nil then showCover = true end
local activeColor = noctalia.getConfig("active_color") or "primary"
local inactiveColor = noctalia.getConfig("inactive_color") or "on_surface_variant"
-- These are plugin settings, not per-widget settings.
local scrollMode = noctalia.getConfig("scroll_mode") or "auto"
@@ -189,9 +191,9 @@ local function getMarqueeOffset(length)
end
local function karaokeColor(charTime, charProgress, position, useGradient)
if not playing then return "on_surface_variant" end
local active = noctalia.isDarkMode() and "primary" or "on_surface"
local inactive = "on_surface_variant"
if not playing then return inactiveColor end
local active = activeColor
local inactive = inactiveColor
if charTime and position then
if not useGradient then
return position >= charTime and active or inactive
@@ -230,8 +232,8 @@ local function buildLineRow(line, opts)
local labels = {}
for sourceIndex = first, last do
local active = playing and (noctalia.isDarkMode() and "primary" or "on_surface") or "on_surface_variant"
local color = opts.dim and "on_surface_variant" or active
local active = playing and activeColor or inactiveColor
local color = opts.dim and inactiveColor or active
if not opts.solid and not opts.dim then
local progress = #chars > 1 and (sourceIndex - 1) / (#chars - 1) or 0
color = karaokeColor(times and times[sourceIndex], progress, opts.position, opts.useGradient)
@@ -316,7 +318,7 @@ local function render()
prefix[#prefix + 1] = ui.glyph({
name = glyph,
size = 14,
color = playing and (noctalia.isDarkMode() and "primary" or "on_surface") or "on_surface_variant",
color = playing and activeColor or inactiveColor,
})
end
+15 -1
View File
@@ -1,6 +1,6 @@
id = "h465855hgg/lyrics"
name = "Lyrics"
version = "1.0.0"
version = "1.1.0"
plugin_api = 3
author = "h465855hgg"
license = "MIT"
@@ -150,3 +150,17 @@ entry = "lyrics.luau"
label_key = "settings.show_cover.label"
description_key = "settings.show_cover.description"
default = true
[[widget.setting]]
key = "active_color"
type = "color"
label_key = "settings.active_color.label"
description_key = "settings.active_color.description"
default = "primary"
[[widget.setting]]
key = "inactive_color"
type = "color"
label_key = "settings.inactive_color.label"
description_key = "settings.inactive_color.description"
default = "on_surface_variant"
+8
View File
@@ -17,6 +17,14 @@
"label": "Show album cover",
"description": "Display the song's album art next to the lyrics."
},
"active_color": {
"label": "Active lyric color",
"description": "Color used for the current and already-sung lyric characters."
},
"inactive_color": {
"label": "Inactive lyric color",
"description": "Color used for upcoming lyrics, paused playback, and secondary lines."
},
"lyrics_source": {
"label": "Lyrics source",
"description": "Choose a preset source, local-player lyrics, a custom endpoint, or external push protocol.",