fix: oklab string format and debounced color history
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user