Skip to content

Instantly share code, notes, and snippets.

@The0x539
The0x539 / color.lua
Last active January 25, 2021 20:16
local function XYZfromRGB(r, g, b)
r, g, b = r/0xFF, g/0xFF, b/0xFF
local function f(n)
if n > 0.04045 then
return math.pow(((n + 0.055) / 1.055), 2.4)
else
return n / 12.92
end
end