This commit is contained in:
yanmao 2022-01-22 12:26:20 +08:00
parent 5f568ed395
commit 14f8f04ba1
1 changed files with 2 additions and 2 deletions

View File

@ -60,8 +60,8 @@ export const toCamelCase = (
*/
export const toHex = (rgb: string): string => {
const hex = (num: string) => {
const char = parseInt(num, 10).toString(16).toUpperCase();
return char.length > 1 ? char : '0' + char;
const numChar = parseInt(num, 10).toString(16).toUpperCase();
return numChar.length > 1 ? numChar : '0' + numChar;
};
const reg = /rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/gi;