Last active
October 24, 2024 16:14
-
-
Save AlvisonHunterArnuero/2c90ef491a1f849f4b431e4b07dea48d to your computer and use it in GitHub Desktop.
This code defines a theme color system and retrieves hex color codes based on a given color name, logging the result.
This file contains 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
const themeTextColorPalette = { | |
primary: "#3B5998", | |
secondary: "#8B9DC3", | |
dark: "#333333", | |
light: "#F7F7F7", | |
muted: "#CCC222", | |
} as const; | |
type ThemeTextColorName = keyof typeof themeTextColorPalette; | |
const getHexColorCode = (colorName: ThemeTextColorName): string => { | |
return themeTextColorPalette[colorName]; | |
} | |
const newColor: ThemeTextColorName = "dark"; | |
const hexColor = getHexColorCode(newColor); | |
console.log(`Hex Color for ${newColor} is ${hexColor}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment