From de8b3e3343c8a27920f75af9faace3c830e1cacc Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 2 Feb 2021 17:10:13 -0400 Subject: refactor FG -> Color --- upd8.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/upd8.js b/upd8.js index 01a3cb2..8395859 100755 --- a/upd8.js +++ b/upd8.js @@ -686,7 +686,10 @@ async function processAlbumDataFile(file) { return {error: `The album "${album.name}" is missing the "Cover Art" field.`}; } - album.color = getBasicField(albumSection, 'FG') || '#0088ff'; + album.color = ( + getBasicField(albumSection, 'Color') || + getBasicField(albumSection, 'FG') + ); if (!album.name) { return {error: 'Expected "Album" (name) field!'}; @@ -735,7 +738,11 @@ async function processAlbumDataFile(file) { const groupName = getBasicField(section, 'Group'); if (groupName) { group = groupName; - groupColor = getBasicField(section, 'FG') || album.color; + groupColor = ( + getBasicField(section, 'Color') || + getBasicField(section, 'FG') || + album.color + ); album.usesGroups = true; continue; } @@ -885,7 +892,10 @@ async function processFlashDataFile(file) { return sections.map(section => { if (getBasicField(section, 'ACT')) { act = getBasicField(section, 'ACT'); - color = getBasicField(section, 'FG'); + color = ( + getBasicField(section, 'Color') || + getBasicField(section, 'FG') + ); const anchor = getBasicField(section, 'Anchor'); const jump = getBasicField(section, 'Jump'); const jumpColor = getBasicField(section, 'Jump Color') || color; @@ -3361,6 +3371,10 @@ function rgb2hsl(r,g,b) { } function getColorVariables(color) { + if (!color) { + color = wikiInfo.color; + } + const [ r, g, b ] = color.slice(1) .match(/[0-9a-fA-F]{2,2}/g) .slice(0, 3) -- cgit 1.3.0-6-gf8a5