-
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
196b41f
commit c5c3dd5
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { DEFAULT, defmulti } from "@thi.ng/defmulti/defmulti"; | ||
import type { TypedColor } from "./api.js"; | ||
import { hsv } from "./hsv/hsv.js"; | ||
import { __dispatch0 } from "./internal/dispatch.js"; | ||
|
||
/** | ||
* Returns the (normalized) hue of given color. | ||
* | ||
* @remarks | ||
* Since LCH uses different hue values than the more familiar HSV/HSL color | ||
* wheel, LCH colors will be first converted to HSV to ensure uniform results. | ||
*/ | ||
export const hue = defmulti<TypedColor<any>, number>( | ||
__dispatch0, | ||
{ | ||
hcy: "hsv", | ||
hsi: "hsv", | ||
hsl: "hsv", | ||
}, | ||
{ | ||
[DEFAULT]: (col: TypedColor<any>) => hsv(col)[0], | ||
|
||
hsv: (col) => col[0], | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters