-
-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathHslaColorPicker.tsx
More file actions
18 lines (15 loc) · 663 Bytes
/
HslaColorPicker.tsx
File metadata and controls
18 lines (15 loc) · 663 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import React from "react";
import { AlphaColorPicker } from "./common/AlphaColorPicker";
import { ColorModel, ColorPickerBaseProps, HslaColor } from "../types";
import { equalColorObjects } from "../utils/compare";
import { hslaToHsva, hsvaToHsla, updateAlphaFromObject } from "../utils/convert";
const colorModel: ColorModel<HslaColor> = {
defaultColor: { h: 0, s: 0, l: 0, a: 1 },
toHsva: hslaToHsva,
fromHsva: hsvaToHsla,
equal: equalColorObjects,
updateAlpha: updateAlphaFromObject,
};
export const HslaColorPicker = (props: Partial<ColorPickerBaseProps<HslaColor>>): JSX.Element => (
<AlphaColorPicker {...props} colorModel={colorModel} />
);