🎨 (Color) add contrast color
This commit is contained in:
@@ -40,6 +40,16 @@ export const slug = (text: string): string => {
|
||||
.replace(/-+$/, '') // Trim - from end of text
|
||||
}
|
||||
|
||||
export const findContrastColor = (value: string): string | null => {
|
||||
if (!value) {
|
||||
return null
|
||||
}
|
||||
const find: IColor | undefined = colors.find(
|
||||
(color: IColor) => color.value === value
|
||||
)
|
||||
return (find && find.constrastColor) || null
|
||||
}
|
||||
|
||||
export const findDarkValue = (value: string): string | null => {
|
||||
if (!value) {
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user