chore: 增加颜色转换方法

This commit is contained in:
xiaozzzi 2024-01-06 21:49:28 +08:00
parent f7b355bb9c
commit 535ba3eed6

View File

@ -123,6 +123,16 @@ export const hexToRgba = (hex: string) => {
return toRgbaString(colorObj)
}
/**
* rgb颜色字符串转化为16进制颜色字符串
* @param rgb rgb颜色字符串
* @returns 16
*/
export const rgbToHex = (rgb: string) => {
const colorObj = parseColorString(rgb)
return toHexString(colorObj)
}
/**
* rgba颜色字符串转化为16进制颜色字符串
* @param rgba rgba颜色字符串