diff options
-rw-r--r-- | src/content/dependencies/generateAlbumTrackListItem.js | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/content/dependencies/generateAlbumTrackListItem.js b/src/content/dependencies/generateAlbumTrackListItem.js index fb315cb1..dd41ba11 100644 --- a/src/content/dependencies/generateAlbumTrackListItem.js +++ b/src/content/dependencies/generateAlbumTrackListItem.js @@ -7,7 +7,7 @@ export default { ], extraDependencies: [ - 'getLinkThemeString', + 'getColors', 'html', 'language', ], @@ -27,7 +27,7 @@ export default { return relations; }, - data(track) { + data(track, album) { const data = {}; data.color = track.color; @@ -36,12 +36,14 @@ export default { data.showArtists = !compareArrays( track.artistContribs.map(c => c.who), - track.album.artistContribs.map(c => c.who), + album.artistContribs.map(c => c.who), {checkOrder: false}); + + return data; }, generate(data, relations, { - getLinkThemeString, + getColors, html, language, }) { @@ -50,8 +52,14 @@ export default { track: relations.trackLink, }; + let style; + if (data.color) { + const {primary} = getColors(data.color); + style = `--primary-color: ${primary}`; + } + return html.tag('li', - {style: getLinkThemeString(data.color)}, + {style}, (!data.showArtists ? language.$('trackList.item.withDuration', stringOpts) : language.$('trackList.item.withDuration.withArtists', { |