mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 添加缓存主题色
This commit is contained in:
@ -136,3 +136,11 @@ export function addColorAlpha(color: string, alpha: number) {
|
||||
export function mixColor(firstColor: string, secondColor: string, ratio: number) {
|
||||
return colord(firstColor).mix(secondColor, ratio).toHex();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是白颜色
|
||||
* @param color - 颜色
|
||||
*/
|
||||
export function isWhiteColor(color: string) {
|
||||
return colord(color).isEqual('#ffffff');
|
||||
}
|
||||
|
@ -5,3 +5,4 @@ export * from './number';
|
||||
export * from './object';
|
||||
export * from './icon';
|
||||
export * from './design-pattern';
|
||||
export * from './theme';
|
||||
|
16
src/utils/common/theme.ts
Normal file
16
src/utils/common/theme.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { EnumStorageKey } from '@/enum';
|
||||
|
||||
/**
|
||||
* 缓存主题颜色
|
||||
* @param color
|
||||
*/
|
||||
export function setThemeColor(color: string) {
|
||||
window.localStorage.setItem(EnumStorageKey['theme-color'], color);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存的主题颜色
|
||||
*/
|
||||
export function getThemeColor() {
|
||||
return window.localStorage.getItem(EnumStorageKey['theme-color']);
|
||||
}
|
Reference in New Issue
Block a user