fix: oklab string format and debounced color history

This commit is contained in:
2026-02-23 17:52:06 +01:00
parent 2d59f3aaca
commit ab930a3279
2 changed files with 24 additions and 6 deletions

View File

@@ -32,7 +32,11 @@ export function ColorInfo({ info, className }: ColorInfoProps) {
};
const formatLab = (lab: { l: number; a: number; b: number }) => {
return `lab(${lab.l.toFixed(1)}, ${lab.a.toFixed(1)}, ${lab.b.toFixed(1)})`;
return `lab(${lab.l.toFixed(1)} ${lab.a.toFixed(1)} ${lab.b.toFixed(1)})`;
};
const formatOkLab = (oklab: { l: number; a: number; b: number }) => {
return `oklab(${(oklab.l * 100).toFixed(1)}% ${oklab.a.toFixed(3)} ${oklab.b.toFixed(3)})`;
};
const formats = [
@@ -40,7 +44,7 @@ export function ColorInfo({ info, className }: ColorInfoProps) {
{ label: 'RGB', value: formatRgb(info.rgb) },
{ label: 'HSL', value: formatHsl(info.hsl) },
{ label: 'Lab', value: formatLab(info.lab) },
{ label: 'OkLab', value: formatLab(info.oklab) },
{ label: 'OkLab', value: formatOkLab(info.oklab) },
];
return (