add color utilities

This commit is contained in:
jeffvli
2025-09-29 03:09:39 -07:00
parent 9cfe396d0f
commit d4b8b12687
4 changed files with 79 additions and 18 deletions
+5
View File
@@ -0,0 +1,5 @@
import { isLightColor as isLightColorMantine } from '@mantine/core';
export const isLightColor = (color: string) => {
return isLightColorMantine(color);
};
+11
View File
@@ -0,0 +1,11 @@
import stc from 'string-to-color';
import { isLightColor } from '/@/shared/utils/is-light-color';
const randomSeed = '121212';
export const stringToColor = (string: string) => {
const hex = stc({ seed: randomSeed, string });
return { color: hex, isLight: isLightColor(hex) };
};