Last active
November 22, 2022 08:46
-
-
Save maradondt/06770fd0f1caf04926cfb8552d787c0c to your computer and use it in GitHub Desktop.
generate gray colors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface Color { | |
50: string; | |
100: string; | |
200: string; | |
300: string; | |
400: string; | |
500: string; | |
600: string; | |
700: string; | |
800: string; | |
900: string; | |
} | |
export const generateGrayColors = (): Color => { | |
return Array(10) | |
.fill((i: number) => (i === 0 ? 0.05 : '0.' + i)) | |
.map((f, i) => f(i)) | |
.reduce((acc, label) => { | |
return { ...acc, [label * 1000]: `hsl(0deg, 0%, ${(1 - Number(label)) * 100}%)` }; | |
}, {} as Record<string, string>); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment