feat(plugins/core): add support for --winter debug flag (#1341)
This commit is contained in:
@@ -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")) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user