mirror of
https://github.com/blossom-editor/blossom
synced 2024-11-17 22:48:03 +08:00
chore: 增加颜色转换方法
This commit is contained in:
parent
f7b355bb9c
commit
535ba3eed6
@ -123,6 +123,16 @@ export const hexToRgba = (hex: string) => {
|
|||||||
return toRgbaString(colorObj)
|
return toRgbaString(colorObj)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rgb颜色字符串转化为16进制颜色字符串
|
||||||
|
* @param rgb rgb颜色字符串
|
||||||
|
* @returns 16进制颜色字符串
|
||||||
|
*/
|
||||||
|
export const rgbToHex = (rgb: string) => {
|
||||||
|
const colorObj = parseColorString(rgb)
|
||||||
|
return toHexString(colorObj)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rgba颜色字符串转化为16进制颜色字符串
|
* rgba颜色字符串转化为16进制颜色字符串
|
||||||
* @param rgba rgba颜色字符串
|
* @param rgba rgba颜色字符串
|
||||||
|
Loading…
Reference in New Issue
Block a user