Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves issue #45 #46

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions resource-packs/Catppuccin UI/create_flavors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# -*- coding: utf-8 -*-

# Standard imports
from colorsys import (
rgb_to_hls,
hls_to_rgb)
from json import (
dump as json_dump,
load as json_load)
Expand Down Expand Up @@ -142,10 +145,10 @@ def main():
accent_colors = [color.name for color in PALETTE.mocha.colors if color.accent == True]

# Create a map of red2 values since they don't exist in the catppuccin palette
red2 = {PALETTE.mocha.name: (181, 103, 125),
PALETTE.macchiato.name: (176, 100, 112),
PALETTE.frappe.name: (172, 97, 98),
PALETTE.latte.name: (156, 11, 42)}
red2 = {PALETTE.mocha.name: darker_red(PALETTE.mocha.colors.red.hsl),
PALETTE.macchiato.name: darker_red(PALETTE.macchiato.colors.red.hsl),
PALETTE.frappe.name: darker_red(PALETTE.frappe.colors.red.hsl),
PALETTE.latte.name: darker_red(PALETTE.latte.colors.red.hsl)}

# Start to generate different flavors and accent colors from the template.
for flavor_obj in PALETTE:
Expand Down Expand Up @@ -519,6 +522,11 @@ def main():
def rgb_to_tuple(colorRGB):
return (colorRGB.r, colorRGB.g, colorRGB.b)

# Applies a -26% lightness adjustment to the color
def darker_red(colorRGB):
hls_tuple = rgb_to_hls(*rgb_to_tuple(colorRGB))
red2_hls_tuple = (hls_tuple[0], hls_tuple[1] * 0.74, hls_tuple[2])
return tuple(round(i) for i in hls_to_rgb(*red2_hls_tuple))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know how to do this more cleanly, would be open for anyone better to refactor this
The RGB values were pretty much +- 3 for all flavors


if __name__ == '__main__':
main()
Expand Down