summaryrefslogtreecommitdiff
path: root/tools/gencolor.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gencolor.js')
-rw-r--r--tools/gencolor.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/gencolor.js b/tools/gencolor.js
new file mode 100644
index 0000000..ea804e6
--- /dev/null
+++ b/tools/gencolor.js
@@ -0,0 +1,27 @@
+"use strict"
+
+const colors = require("./colors.js")
+
+function lerp(v0, v1, t) {
+ return v0 + t * (v1 - v0)
+}
+
+function lerp_rgb(rgb, x=0, t=0) {
+ let lab = colors.oklab_from_any(colors.parse_hex(rgb))
+ lab.l = lerp(lab.l, x, t)
+ return colors.format_hex(lab)
+}
+
+function make_colors(rgb, sel) {
+ let bg = lerp_rgb(rgb, 1.0, 0.0)
+ let hi = lerp_rgb(rgb, 1.0, 0.4)
+ let sh = lerp_rgb(rgb, 0.2, 0.4)
+ let bd = lerp_rgb(rgb, 0.2, 0.8)
+ console.log(sel + ` { background-color: ${bg}; border-color: ${hi} ${sh} ${sh} ${hi}; box-shadow: 0 0 0 1px ${bd}, 0px 1px 4px #0008; }`)
+}
+
+make_colors("#bbbbbb", ".token.white")
+make_colors("#ef0500", ".token.red")
+make_colors("#da997b", ".token.pink")
+make_colors("#bbb079", ".token.brown")
+make_colors("#a6a6a8", ".token.gray")