微调颜色

This commit is contained in:
sjl
2025-03-17 15:55:30 +08:00
parent 630eb48d28
commit 5f68071c77
25 changed files with 46 additions and 40 deletions

View File

@@ -37,6 +37,7 @@ export function rgbToHex(r: any, g: any, b: any) {
* @returns {String} 返回处理后的颜色值
*/
export function getDarkColor(color: string, level: number) {
let reg = /^\#?[0-9A-Fa-f]{6}$/;
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
let rgb = hexToRgb(color);
@@ -51,6 +52,7 @@ export function getDarkColor(color: string, level: number) {
* @returns {String} 返回处理后的颜色值
*/
export function getLightColor(color: string, level: number) {
let reg = /^\#?[0-9A-Fa-f]{6}$/;
if (!reg.test(color)) return ElMessage.warning("输入错误的hex颜色值");
let rgb = hexToRgb(color);