mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-04 21:18:01 +08:00
67d0462ca9
* test: detect dependency cycle * chore: open eslint import/no-cycle rule close #42804 * chore: Upgrade react-component * Apply suggestions from code review * refactor: add getRoundNumber * chore: Update package.json
17 lines
537 B
TypeScript
17 lines
537 B
TypeScript
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);
|
|
};
|
|
|
|
export const getRoundNumber = (value: number) => Math.round(Number(value || 0));
|
|
|
|
export const getAlphaColor = (color: Color) => getRoundNumber(color.toHsb().a * 100);
|