mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-08 13:00:13 +02:00
add color utilities
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import { isLightColor as isLightColorMantine } from '@mantine/core';
|
||||
|
||||
export const isLightColor = (color: string) => {
|
||||
return isLightColorMantine(color);
|
||||
};
|
||||
@@ -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) };
|
||||
};
|
||||
Reference in New Issue
Block a user