blob: f64fb46292304e514b3a97e4e02cba99740936a5 (
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
31
|
local utils = require "lib.utils"
local oklab = require "lib.oklab"
local palette = utils.get_palette()
local output = [[-- autogenerated from palette.json
local M = {}
local function tone_set(colors)
return setmetatable(colors, {
__call = function(self)
return self[1]
end,
})
end
M.palette = {
]]
for name, value in utils.opairs(palette) do
output = output .. " " .. name .. " = tone_set {\n"
for variant, variant_value in utils.opairs(value) do
local color = oklab.rgb2hex(oklab.oklab2rgb(oklab.oklch2oklab(variant_value)))
output = output .. " " .. (variant == "normal" and [["]] or variant .. [[ = "]]) .. color .. "\",\n"
end
output = output .. " },\n"
end
output = output .. " transparent = \"#00000000\"\n}\n\nreturn M"
print(output)
|