Skip to content

Commit

Permalink
type(Convert): add HexColor type.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed May 12, 2024
1 parent 632d4e9 commit 64cb068
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/color-convert/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export const rgbaToHexa = ({ r, g, b, a }: RgbaColor): string => {
const alpha = typeof a === 'number' && ((a * 255) | (1 << 8)).toString(16).slice(1);
return `${rgbaToHex({ r, g, b, a })}${alpha ? alpha : ''}`;
};

export type HexColor = `#${string}`;
export const hexToHsva = (hex: string): HsvaColor => rgbaToHsva(hexToRgba(hex));
export const hexToRgba = (hex: string): RgbaColor => {
const htemp = hex.replace('#', '');
Expand Down

0 comments on commit 64cb068

Please sign in to comment.