2023-05-12 14:43:48 +08:00
|
|
|
import type { ColorGenInput } from '@rc-component/color-picker';
|
|
|
|
import type { Color } from './color';
|
|
|
|
import { ColorFactory } from './color';
|
|
|
|
|
|
|
|
export const customizePrefixCls = 'ant-color-picker';
|
|
|
|
|
|
|
|
export const generateColor = (color: ColorGenInput<Color>): Color => {
|
|
|
|
if (color instanceof ColorFactory) {
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
return new ColorFactory(color);
|
|
|
|
};
|
|
|
|
|
2023-06-25 15:38:22 +08:00
|
|
|
export const getRoundNumber = (value: number) => Math.round(Number(value || 0));
|
|
|
|
|
2023-05-12 14:43:48 +08:00
|
|
|
export const getAlphaColor = (color: Color) => getRoundNumber(color.toHsb().a * 100);
|