45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
PALETTE = [
|
|
("Red", "#e53935"),
|
|
("Orange", "#fb8c00"),
|
|
("Yellow", "#fdd835"),
|
|
("Green", "#43a047"),
|
|
("Teal", "#00897b"),
|
|
("Blue", "#1e88e5"),
|
|
("Purple", "#8e24aa"),
|
|
("Pink", "#e91e63"),
|
|
("White", "#f5f5f5"),
|
|
("Gray", "#4a5568"),
|
|
]
|
|
|
|
PALETTE_NAMES = [p[0] for p in PALETTE]
|
|
PALETTE_HEX = {p[0]: p[1] for p in PALETTE}
|
|
|
|
PALETTE_VIVID = {
|
|
"Red": "#7f0000",
|
|
"Orange": "#7f3000",
|
|
"Yellow": "#7f6000",
|
|
"Green": "#1b5e20",
|
|
"Teal": "#004d40",
|
|
"Blue": "#0d2b6e",
|
|
"Purple": "#4a0072",
|
|
"Pink": "#7f004d",
|
|
"White": "#9e9e9e",
|
|
"Gray": "#263238",
|
|
}
|
|
|
|
def lighten_hex(hex_color, amount=0):
|
|
hex_color = hex_color.lstrip("#")
|
|
r, g, b = int(hex_color[0:2], 16), int(hex_color[2:4], 16), int(hex_color[4:6], 16)
|
|
r = min(255, r + amount)
|
|
g = min(255, g + amount)
|
|
b = min(255, b + amount)
|
|
return f"#{r:02x}{g:02x}{b:02x}"
|
|
|
|
|
|
def darken_hex(hex_color, amount=60):
|
|
hex_color = hex_color.lstrip("#")
|
|
r, g, b = int(hex_color[0:2], 16), int(hex_color[2:4], 16), int(hex_color[4:6], 16)
|
|
r = max(0, r - amount)
|
|
g = max(0, g - amount)
|
|
b = max(0, b - amount)
|
|
return f"#{r:02x}{g:02x}{b:02x}" |