-
-
Notifications
You must be signed in to change notification settings - Fork 144
/
hsl.ts
47 lines (45 loc) · 1.35 KB
/
hsl.ts
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import type { NumericArray } from "@thi.ng/api";
import type { IRandom } from "@thi.ng/random";
import type { Color, ColorFactory, ReadonlyColor, TypedColor } from "../api.js";
import { defColor } from "../defcolor.js";
import { hsvHsl } from "../hsv/hsv-hsl.js";
import { lchLab } from "../lab/lab-lch.js";
import { labRgb } from "../lab/lab-rgb.js";
import { rgbHsl } from "../rgb/rgb-hsl.js";
import { rgbSrgb } from "../rgb/rgb-srgb.js";
import { hslRgb } from "./hsl-rgb.js";
export declare class HSL implements TypedColor<HSL> {
buf: NumericArray;
offset: number;
stride: number;
h: number;
s: number;
l: number;
alpha: number;
[id: number]: number;
readonly mode: "hsl";
readonly length: 4;
readonly range: [ReadonlyColor, ReadonlyColor];
[Symbol.iterator](): Iterator<number, any, undefined>;
clamp(): this;
copy(): HSL;
copyView(): HSL;
deref(): Color;
empty(): HSL;
eqDelta(o: HSL, eps?: number): boolean;
randomize(rnd?: IRandom): this;
set(src: ReadonlyColor): this;
toJSON(): number[];
}
export const hsl = <ColorFactory<HSL>>defColor({
mode: "hsl",
channels: { h: { hue: true } },
order: <const>["h", "s", "l", "alpha"],
from: {
rgb: rgbHsl,
srgb: rgbHsl,
hsv: hsvHsl,
lch: [lchLab, labRgb, rgbSrgb, rgbHsl],
},
toRgb: hslRgb,
});