Something went wrong. Try again.
Charm-like tui library
Something went wrong. Try again.
123456789101112131415161718192021222324252627const std = @import("std");const utils = @import("utils.zig");const RGB = @import("RGB.zig");
const LAB = @This();
l: f64,a: f64,b: f64,
pub fn toRgb(self: LAB) RGB { const fy = (self.l + 16.0) / 116.0; const fx = fy + self.a / 500.0; const fz = fy - self.b / 200.0; const x = utils.xn * utils.labFInv(fx); const y = utils.yn * utils.labFInv(fy); const z = utils.zn * utils.labFInv(fz); const r = 3.2404542 * x - 1.5371385 * y - 0.4985314 * z; const g = -0.9692660 * x + 1.8760108 * y + 0.0415560 * z; const b = 0.0556434 * x - 0.2040259 * y + 1.0572252 * z; return .{ .r = utils.linearToByte(r), .g = utils.linearToByte(g), .b = utils.linearToByte(b), };}