Complementary lang colors (#76)

This commit is contained in:
b3z
2021-01-23 14:40:12 +01:00
committed by GitHub
parent b25c363ed1
commit 5e0ee81395
3 changed files with 6 additions and 3 deletions

View File

@@ -1067,7 +1067,7 @@ It is possible to use custom colors for languages if those provided by GitHub do
You can specify either an index with a color, or a language name (case insensitive) with a color.
Colors can be either in hexadecimal format or a [named color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
Use the special value `rainbow` to use rainbow colors.
Use the special value `rainbow` to use rainbow colors. Use `complementary` to use [complementary colors](https://en.wikipedia.org/wiki/Complementary_colors).
</details>

View File

@@ -14,6 +14,9 @@
//Custom colors
if (`${colors}` === "rainbow")
colors = ["0:#ff0000", "1:#ffa500", "2:#ffff00", "3:#008000", "4:#0000ff", "5:#4b0082", "6:#ee82ee", "7:#162221"]
if (`${colors}` === "complementary")
colors = ["0:#ff0000", "1:#008000", "2:#ffa500", "3:#0000ff", "4:#ffff00", "5:#4b0082", "6:#162221", "7:#ee82ee"]
colors = Object.fromEntries(decodeURIComponent(colors).split(",").map(x => x.trim().toLocaleLowerCase()).filter(x => x).map(x => x.split(":").map(x => x.trim())))
console.debug(`metrics/compute/${login}/plugins > languages > custom colors ${JSON.stringify(colors)}`)
//Iterate through user's repositories and retrieve languages data
@@ -54,4 +57,4 @@
catch (error) {
throw {error:{message:"An error occured", instance:error}}
}
}
}

View File

@@ -149,7 +149,7 @@
}],
["Language plugin (custom color set)", {
plugin_languages:true,
plugin_languages_colors:"rainbow",
plugin_languages_colors:"complementary",
}],
["Language plugin (complete)", {
plugin_languages:true,