feat(plugins/core): add support for --winter debug flag (#1341)

This commit is contained in:
Simon Lecoq
2023-01-09 02:37:35 -05:00
committed by GitHub
parent d2c70c4e21
commit ce8daa099b
4 changed files with 30 additions and 13 deletions

View File

@@ -144,25 +144,32 @@ export default async function({login, q}, {conf, data, rest, graphql, plugins, q
console.debug(`metrics/compute/${login} > applying dflag --cakeday`) console.debug(`metrics/compute/${login} > applying dflag --cakeday`)
computed.cakeday = true 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`) console.debug(`metrics/compute/${login} > applying dflag --halloween`)
//Halloween color replacer //Color replacer
const halloween = content => const replace = content =>
content content
.replace(/--color-calendar-graph/g, "--color-calendar-halloween-graph") .replace(/--color-calendar-graph/g, `--color-calendar-${color}-graph`)
.replace(/#9be9a8/gi, "var(--color-calendar-halloween-graph-day-L1-bg)") .replace(/#9be9a8/gi, `var(--color-calendar-${color}-graph-day-L1-bg)`)
.replace(/#40c463/gi, "var(--color-calendar-halloween-graph-day-L2-bg)") .replace(/#40c463/gi, `var(--color-calendar-${color}-graph-day-L2-bg)`)
.replace(/#30a14e/gi, "var(--color-calendar-halloween-graph-day-L3-bg)") .replace(/#30a14e/gi, `var(--color-calendar-${color}-graph-day-L3-bg)`)
.replace(/#216e39/gi, "var(--color-calendar-halloween-graph-day-L4-bg)") .replace(/#216e39/gi, `var(--color-calendar-${color}-graph-day-L4-bg)`)
//Update contribution calendar colors //Update contribution calendar colors
computed.calendar.map(day => day.color = halloween(day.color)) computed.calendar.map(day => day.color = replace(day.color))
//Update isocalendar colors //Update calendars colors
const waiting = [...pending] const waiting = [...pending]
pending.push((async () => { pending.push((async () => {
await Promise.all(waiting) await Promise.all(waiting)
if (data.plugins.isocalendar?.svg) if (data.plugins.isocalendar?.svg)
data.plugins.isocalendar.svg = halloween(data.plugins.isocalendar.svg) data.plugins.isocalendar.svg = replace(data.plugins.isocalendar.svg)
return {name: "dflag.halloween", result: true} 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")) { if (dflags.includes("--error")) {

View File

@@ -536,7 +536,8 @@ inputs:
description: | description: |
Debug flags Debug flags
- `--cakeday`: simulate registration anniversary - `--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 - `--error`: force render error
- `--puppeteer-debug`: enable puppeteer debug mode\* - `--puppeteer-debug`: enable puppeteer debug mode\*
- `--puppeteer-disable-headless`: disable puppeteer headless mode *(requires a graphical environment)*\* - `--puppeteer-disable-headless`: disable puppeteer headless mode *(requires a graphical environment)*\*
@@ -554,6 +555,7 @@ inputs:
values: values:
- --cakeday - --cakeday
- --halloween - --halloween
- --winter
- --error - --error
- --puppeteer-debug - --puppeteer-debug
- --puppeteer-disable-headless - --puppeteer-disable-headless

View File

@@ -1560,6 +1560,10 @@
--color-calendar-halloween-graph-day-L2-bg: #ffc501; --color-calendar-halloween-graph-day-L2-bg: #ffc501;
--color-calendar-halloween-graph-day-L3-bg: #fe9600; --color-calendar-halloween-graph-day-L3-bg: #fe9600;
--color-calendar-halloween-graph-day-L4-bg: #03001c; --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-L4-border: rgba(27,31,35,0.06);
--color-calendar-graph-day-L3-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); --color-calendar-graph-day-L2-border: rgba(27,31,35,0.06);

View File

@@ -140,6 +140,10 @@
--color-calendar-halloween-graph-day-L2-bg: #ffc501; --color-calendar-halloween-graph-day-L2-bg: #ffc501;
--color-calendar-halloween-graph-day-L3-bg: #fe9600; --color-calendar-halloween-graph-day-L3-bg: #fe9600;
--color-calendar-halloween-graph-day-L4-bg: #03001c; --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-L4-border: rgba(27,31,35,0.06);
--color-calendar-graph-day-L3-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); --color-calendar-graph-day-L2-border: rgba(27,31,35,0.06);