diff --git a/source/plugins/core/index.mjs b/source/plugins/core/index.mjs index f5aae8ba..25fb23f4 100644 --- a/source/plugins/core/index.mjs +++ b/source/plugins/core/index.mjs @@ -144,25 +144,32 @@ export default async function({login, q}, {conf, data, rest, graphql, plugins, q console.debug(`metrics/compute/${login} > applying dflag --cakeday`) computed.cakeday = true } - if (dflags.includes("--halloween")) { + if ((dflags.includes("--halloween"))||(dflags.includes("--winter"))) { + const color = dflags.find(color => ["--halloween", "--winter"].includes(color)).replace("--", "") console.debug(`metrics/compute/${login} > applying dflag --halloween`) - //Halloween color replacer - const halloween = content => + //Color replacer + const replace = content => content - .replace(/--color-calendar-graph/g, "--color-calendar-halloween-graph") - .replace(/#9be9a8/gi, "var(--color-calendar-halloween-graph-day-L1-bg)") - .replace(/#40c463/gi, "var(--color-calendar-halloween-graph-day-L2-bg)") - .replace(/#30a14e/gi, "var(--color-calendar-halloween-graph-day-L3-bg)") - .replace(/#216e39/gi, "var(--color-calendar-halloween-graph-day-L4-bg)") + .replace(/--color-calendar-graph/g, `--color-calendar-${color}-graph`) + .replace(/#9be9a8/gi, `var(--color-calendar-${color}-graph-day-L1-bg)`) + .replace(/#40c463/gi, `var(--color-calendar-${color}-graph-day-L2-bg)`) + .replace(/#30a14e/gi, `var(--color-calendar-${color}-graph-day-L3-bg)`) + .replace(/#216e39/gi, `var(--color-calendar-${color}-graph-day-L4-bg)`) //Update contribution calendar colors - computed.calendar.map(day => day.color = halloween(day.color)) - //Update isocalendar colors + computed.calendar.map(day => day.color = replace(day.color)) + //Update calendars colors const waiting = [...pending] pending.push((async () => { await Promise.all(waiting) if (data.plugins.isocalendar?.svg) - data.plugins.isocalendar.svg = halloween(data.plugins.isocalendar.svg) - return {name: "dflag.halloween", result: true} + data.plugins.isocalendar.svg = replace(data.plugins.isocalendar.svg) + if (data.plugins.calendar?.years) { + for (const {weeks} of data.plugins.calendar.years) { + for (const {contributionDays} of weeks) + contributionDays.forEach(day => day.color = replace(day.color)) + } + } + return {name: `dflag.${color}`, result: true} })()) } if (dflags.includes("--error")) { diff --git a/source/plugins/core/metadata.yml b/source/plugins/core/metadata.yml index 6da248ad..07331d7c 100644 --- a/source/plugins/core/metadata.yml +++ b/source/plugins/core/metadata.yml @@ -536,7 +536,8 @@ inputs: description: | Debug flags - `--cakeday`: simulate registration anniversary - - `--halloween`: enable halloween colors + - `--halloween`: enable halloween colors *(only first color scheme will be applied if multiple are specified)* + - `--winter`: enable winter colors *(only first color scheme will be applied if multiple are specified)* - `--error`: force render error - `--puppeteer-debug`: enable puppeteer debug mode\* - `--puppeteer-disable-headless`: disable puppeteer headless mode *(requires a graphical environment)*\* @@ -554,6 +555,7 @@ inputs: values: - --cakeday - --halloween + - --winter - --error - --puppeteer-debug - --puppeteer-disable-headless diff --git a/source/templates/classic/style.css b/source/templates/classic/style.css index 6e562ccd..f7788019 100644 --- a/source/templates/classic/style.css +++ b/source/templates/classic/style.css @@ -1560,6 +1560,10 @@ --color-calendar-halloween-graph-day-L2-bg: #ffc501; --color-calendar-halloween-graph-day-L3-bg: #fe9600; --color-calendar-halloween-graph-day-L4-bg: #03001c; + --color-calendar-winter-graph-day-L1-bg: #0a3069; + --color-calendar-winter-graph-day-L2-bg: #0969da; + --color-calendar-winter-graph-day-L3-bg: #54aeff; + --color-calendar-winter-graph-day-L4-bg: #b6e3ff; --color-calendar-graph-day-L4-border: rgba(27,31,35,0.06); --color-calendar-graph-day-L3-border: rgba(27,31,35,0.06); --color-calendar-graph-day-L2-border: rgba(27,31,35,0.06); diff --git a/source/templates/terminal/style.css b/source/templates/terminal/style.css index 3492118e..42b02b63 100644 --- a/source/templates/terminal/style.css +++ b/source/templates/terminal/style.css @@ -140,6 +140,10 @@ --color-calendar-halloween-graph-day-L2-bg: #ffc501; --color-calendar-halloween-graph-day-L3-bg: #fe9600; --color-calendar-halloween-graph-day-L4-bg: #03001c; + --color-calendar-winter-graph-day-L1-bg: #0a3069; + --color-calendar-winter-graph-day-L2-bg: #0969da; + --color-calendar-winter-graph-day-L3-bg: #54aeff; + --color-calendar-winter-graph-day-L4-bg: #b6e3ff; --color-calendar-graph-day-L4-border: rgba(27,31,35,0.06); --color-calendar-graph-day-L3-border: rgba(27,31,35,0.06); --color-calendar-graph-day-L2-border: rgba(27,31,35,0.06);