Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions source/plugins/core/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down
4 changes: 3 additions & 1 deletion source/plugins/core/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)*\*
Expand All @@ -554,6 +555,7 @@ inputs:
values:
- --cakeday
- --halloween
- --winter
- --error
- --puppeteer-debug
- --puppeteer-disable-headless
Expand Down
4 changes: 4 additions & 0 deletions source/templates/classic/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions source/templates/terminal/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down