riso.css/build.py

123 lines
2.9 KiB
Python
Raw Permalink Normal View History

2025-06-29 06:48:52 -04:00
"""Build the riso.css file"""
# Configuration
# Filename to write the css data to
FILENAME = "riso.css"
# Prefix used by color variables (ex: "{prefix}-mint")
CSS_PREFIX = "riso"
# Variable Scope in the DOM
CSS_SCOPE = ":root"
type nameT = str
type colorT = int
# Color data from https://www.stencil.wiki/colors
COLORS: dict[nameT, colorT] = {
# "Standard" colors
"black": 0x000000,
"burgundy": 0x914E72,
"blue": 0x0078BF,
"green": 0x00A95C,
"medium-blue": 0x3255A4,
"bright-red": 0xF15060,
"risofedral-blue": 0x3D5588,
"purple": 0x765BA7,
"teal": 0x00838A,
"flat-gold": 0xBB8B41,
"hunter-green": 0x407060,
"red": 0xFF665E,
"brown": 0x925F52,
"yellow": 0xFFE800,
"marine-red": 0xD2515E,
"orange": 0xFF6C2F,
"fluorescent-pink": 0xFF48B0,
"light-gray": 0x88898A,
# "Special Edition" colors
"metallic-silver": 0x9C9C9C,
"flatallic-gold": 0xB48F50,
"metallic-gold": 0xAC936E,
"crimson": 0xE45D50,
"fluorescent-orange": 0xFF7477,
"cornflower": 0x62A8E5,
"sky-blue": 0x4982CF,
"sea-blue": 0x0074A2,
"lake": 0x235BA8,
"indigo": 0x484D7A,
"midnight": 0x435060,
"mist": 0xB8C7C4,
"granite": 0xA5AAA8,
"charcoal": 0x70747C,
"smoky-teal": 0x5F8289,
"steel": 0x375E77,
"slate": 0x5E695,
"turquoise": 0x00AA93,
"emerald": 0x19975D,
"grass": 0x397E58,
"forest": 0x516E5A,
"spruce": 0x4A635D,
"moss": 0x68724D,
"sea-foam": 0x62C2B1,
"kelly-green": 0x67B346,
"light-teal": 0x009DA5,
"ivy": 0x169B62,
"pine": 0x237E74,
"lagoon": 0x2F6165,
"violet": 0x9D7AD2,
"orchid": 0xBB76CF,
"plum": 0x845991,
"raisin": 0x775D7A,
"grape": 0x6C5D80,
"scarlet": 0xF65058,
"tomato": 0xD2515E,
"cranberry": 0xC24F5D,
"maroon": 0x9E4C6E,
"raspberry-red": 0xB4B65,
"brick": 0xA75154,
"light-lime": 0xE3ED55,
"sunflower": 0xFFB511,
"melon": 0xFFAE3B,
"apricot": 0xF6A04D,
"paprika": 0xEE7F4B,
"pumpkin": 0xFF6F4C,
"bright-olive-green": 0xB49F29,
"bright-gold": 0xBA8032,
"copper": 0xBD6439,
"mahogany": 0x8E595A,
"bisque": 0xF2CDCF,
"bubble-gum": 0xF984CA,
"light-mauve": 0xE6B5C9,
"dark-mauve": 0xBD8CA6,
"wine": 0x914E72,
"gray": 0x928D88,
# "Custom" colors
"coral": 0xFF8E91,
"white": 0xFFFFFF,
"aqua": 0x5EC9E5,
"mint": 0x82D8D5,
# Omitting "Clear Medium" as it is transparent
"fluorescent-yellow": 0xF7DD00,
"fluorescent-red": 0xFF4C65,
"fluorescent-green": 0x44D62C,
}
def main():
# Open file for writing
with open(FILENAME, "w") as f:
# Write first line (css scope and open brace)
f.write(f"{CSS_SCOPE} {{\n")
# Generate and write each CSS rule
f.writelines(
f"\t--{CSS_PREFIX}-{name}: #{color:06x};\n"
for name, color in COLORS.items()
)
# Write closing brace
f.write("}")
if __name__ == "__main__":
main()