blob: 9201f625eea1c2d9e579746362cd12770122cc86 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
local utils = require "lib.utils"
local oklab = require "lib.oklab"
local palette = utils.get_palette()
local output = {}
local function generate(supports)
table.insert(output, ":root{")
for name, value in utils.opairs(palette) do
for variant, v_value in utils.opairs(value) do
local color
if supports then
color = "oklch(" .. v_value.l .. "%," .. v_value.c .. "," .. v_value.h .. ")"
else
color = oklab.rgb2hex(oklab.oklab2rgb(oklab.oklch2oklab(v_value)))
end
table.insert(output, "--prismite-" .. name .. (variant == "normal" and "" or "-" .. variant) .. ":" .. color .. ";")
end
end
table.insert(output, "}")
end
generate(false)
table.insert(output, "")
generate(true)
for _, line in ipairs(output) do
io.write(line)
end
|