🎨 (Color) add contrast color

This commit is contained in:
Julien Calixte
2019-10-25 19:37:28 +02:00
parent 20a02ce294
commit e38637020d
10 changed files with 95 additions and 30 deletions

View File

@@ -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