feat(lyrics): add customizable colors
This commit is contained in:
@@ -70,6 +70,8 @@ Plugin settings:
|
|||||||
| `show_artist` | `bool` | `true` | Includes the artist in track-information mode. |
|
| `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. |
|
| `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. |
|
| `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
|
## IPC
|
||||||
|
|
||||||
|
|||||||
+8
-6
@@ -8,6 +8,8 @@ local showArtist = noctalia.getConfig("show_artist")
|
|||||||
local hideWhenPaused = noctalia.getConfig("hide_when_paused")
|
local hideWhenPaused = noctalia.getConfig("hide_when_paused")
|
||||||
local showCover = noctalia.getConfig("show_cover")
|
local showCover = noctalia.getConfig("show_cover")
|
||||||
if showCover == nil then showCover = true end
|
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.
|
-- These are plugin settings, not per-widget settings.
|
||||||
local scrollMode = noctalia.getConfig("scroll_mode") or "auto"
|
local scrollMode = noctalia.getConfig("scroll_mode") or "auto"
|
||||||
@@ -189,9 +191,9 @@ local function getMarqueeOffset(length)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function karaokeColor(charTime, charProgress, position, useGradient)
|
local function karaokeColor(charTime, charProgress, position, useGradient)
|
||||||
if not playing then return "on_surface_variant" end
|
if not playing then return inactiveColor end
|
||||||
local active = noctalia.isDarkMode() and "primary" or "on_surface"
|
local active = activeColor
|
||||||
local inactive = "on_surface_variant"
|
local inactive = inactiveColor
|
||||||
if charTime and position then
|
if charTime and position then
|
||||||
if not useGradient then
|
if not useGradient then
|
||||||
return position >= charTime and active or inactive
|
return position >= charTime and active or inactive
|
||||||
@@ -230,8 +232,8 @@ local function buildLineRow(line, opts)
|
|||||||
local labels = {}
|
local labels = {}
|
||||||
|
|
||||||
for sourceIndex = first, last do
|
for sourceIndex = first, last do
|
||||||
local active = playing and (noctalia.isDarkMode() and "primary" or "on_surface") or "on_surface_variant"
|
local active = playing and activeColor or inactiveColor
|
||||||
local color = opts.dim and "on_surface_variant" or active
|
local color = opts.dim and inactiveColor or active
|
||||||
if not opts.solid and not opts.dim then
|
if not opts.solid and not opts.dim then
|
||||||
local progress = #chars > 1 and (sourceIndex - 1) / (#chars - 1) or 0
|
local progress = #chars > 1 and (sourceIndex - 1) / (#chars - 1) or 0
|
||||||
color = karaokeColor(times and times[sourceIndex], progress, opts.position, opts.useGradient)
|
color = karaokeColor(times and times[sourceIndex], progress, opts.position, opts.useGradient)
|
||||||
@@ -316,7 +318,7 @@ local function render()
|
|||||||
prefix[#prefix + 1] = ui.glyph({
|
prefix[#prefix + 1] = ui.glyph({
|
||||||
name = glyph,
|
name = glyph,
|
||||||
size = 14,
|
size = 14,
|
||||||
color = playing and (noctalia.isDarkMode() and "primary" or "on_surface") or "on_surface_variant",
|
color = playing and activeColor or inactiveColor,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+15
-1
@@ -1,6 +1,6 @@
|
|||||||
id = "h465855hgg/lyrics"
|
id = "h465855hgg/lyrics"
|
||||||
name = "Lyrics"
|
name = "Lyrics"
|
||||||
version = "1.0.0"
|
version = "1.1.0"
|
||||||
plugin_api = 3
|
plugin_api = 3
|
||||||
author = "h465855hgg"
|
author = "h465855hgg"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@@ -150,3 +150,17 @@ entry = "lyrics.luau"
|
|||||||
label_key = "settings.show_cover.label"
|
label_key = "settings.show_cover.label"
|
||||||
description_key = "settings.show_cover.description"
|
description_key = "settings.show_cover.description"
|
||||||
default = true
|
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"
|
||||||
|
|||||||
@@ -17,6 +17,14 @@
|
|||||||
"label": "Show album cover",
|
"label": "Show album cover",
|
||||||
"description": "Display the song's album art next to the lyrics."
|
"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": {
|
"lyrics_source": {
|
||||||
"label": "Lyrics source",
|
"label": "Lyrics source",
|
||||||
"description": "Choose a preset source, local-player lyrics, a custom endpoint, or external push protocol.",
|
"description": "Choose a preset source, local-player lyrics, a custom endpoint, or external push protocol.",
|
||||||
|
|||||||
Reference in New Issue
Block a user