From 8702e3c5ae62b60437eeeec8728c1ff9ee1be642 Mon Sep 17 00:00:00 2001 From: Pranav Date: Wed, 18 Jan 2023 08:27:40 +0530 Subject: [PATCH] feat: start themeing firefox sections as well Signed-off-by: Pranav --- .gitignore | 3 ++- scripts/create_theme.py | 5 +++-- scripts/recolor.py | 47 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 51fd411e..25115b2f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ __pycache__ venv/ # Releases folder -releases \ No newline at end of file +releases +chrome \ No newline at end of file diff --git a/scripts/create_theme.py b/scripts/create_theme.py index b7fe07f3..ff124cf4 100644 --- a/scripts/create_theme.py +++ b/scripts/create_theme.py @@ -6,7 +6,7 @@ from typing import List from scripts.ctp_colors import ctp_colors from scripts.recolor import recolor from scripts.utils import zip_multiple_folders -from scripts.var import def_color_map, theme_name, work_dir +from scripts.var import def_color_map, repo_dir, src_dir, theme_name, work_dir def create_theme(types: List[str], accents: List[str], dest: str, link: bool = False, @@ -25,7 +25,8 @@ def create_theme(types: List[str], accents: List[str], dest: str, link: bool = F install_cmd: str = f"./install.sh -c {theme_style} -s {size} -n {name} -d {dest} -t {def_color_map[accent]}" if tweaks: install_cmd += f" --tweaks {' '.join([tweak for tweak in tweaks])}" - + shutil.rmtree(f"{repo_dir}/chrome", ignore_errors=True) + shutil.copytree(f"{src_dir}/other/firefox/chrome", f"{repo_dir}/chrome") os.chdir(work_dir) subprocess.call("./build.sh", shell=True) # Rebuild all scss subprocess.call(install_cmd, shell=True) # Install the theme globally for you diff --git a/scripts/recolor.py b/scripts/recolor.py index 625522a0..b01d4e76 100644 --- a/scripts/recolor.py +++ b/scripts/recolor.py @@ -20,6 +20,52 @@ def recolor_accent(flavor, accent: str = "blue"): work_dir, def_accent_light[def_color_map[accent]], Flavour.latte().__dict__[accent].hex) +def recolor_firefox(flavor, accent: str = "blue"): + """ + Recolor the custom gnomish firefox to catpuccin color + """ + firefox_color_file_dark = f"{src_dir}/other/firefox/chrome/Colloid/colors/dark.css" + firefox_color_file_light = f"{src_dir}/other/firefox/chrome/Colloid/colors/light.css" + + replacetext(firefox_color_file_light, "2e3436", flavor.base.hex) + replacetext(firefox_color_file_light, "fafafa", Flavour.latte().base.hex) + replacetext(firefox_color_file_light, "f2f2f2", flavor.crust.hex) + replacetext(firefox_color_file_light, "303030", Flavour.mocha().base.hex) + replacetext(firefox_color_file_light, "ffffff", flavor.base.hex) + replacetext(firefox_color_file_light, "5b9bf8", flavor.surface0.hex) + replacetext(firefox_color_file_light, "3c84f7", flavor.__dict__[accent].hex) + replacetext(firefox_color_file_light, "dedede", flavor.surface1.hex) + replacetext(firefox_color_file_light, "f0f0f0", flavor.surface0.hex) + replacetext(firefox_color_file_light, "FAFAFA", flavor.surface1.hex) + replacetext(firefox_color_file_light, "fafafa", flavor.surface0.hex) + replacetext(firefox_color_file_light, "323232", flavor.mantle.hex) + replacetext(firefox_color_file_light, "d5d0cc", flavor.subtext1.hex) + + # Buttons + replacetext(firefox_color_file_light, "fd5f51", flavor.red.hex) + replacetext(firefox_color_file_light, "38c76a", flavor.green.hex) + replacetext(firefox_color_file_light, "fdbe04", flavor.yellow.hex) + + # Dark + replacetext(firefox_color_file_dark, "eeeeee", flavor.base.hex) + replacetext(firefox_color_file_dark, "2c2c2c", Flavour.mocha().base.hex) + replacetext(firefox_color_file_dark, "242424", flavor.crust.hex) + replacetext(firefox_color_file_dark, "ffffff", Flavour.latte().base.hex) + replacetext(firefox_color_file_dark, "383838", flavor.base.hex) + replacetext(firefox_color_file_dark, "3584e4", flavor.surface0.hex) + replacetext(firefox_color_file_dark, "78aeed", flavor.__dict__[accent].hex) + replacetext(firefox_color_file_dark, "363636", flavor.surface1.hex) + replacetext(firefox_color_file_dark, "404040", flavor.surface0.hex) + replacetext(firefox_color_file_dark, "4F4F4F", flavor.surface1.hex) + replacetext(firefox_color_file_dark, "444444", flavor.surface0.hex) + replacetext(firefox_color_file_dark, "323232", flavor.mantle.hex) + replacetext(firefox_color_file_dark, "919191", flavor.subtext1.hex) + + # Buttons + replacetext(firefox_color_file_dark, "fd5f51", flavor.red.hex) + replacetext(firefox_color_file_dark, "38c76a", flavor.green.hex) + replacetext(firefox_color_file_dark, "fdbe04", flavor.yellow.hex) + def recolor(flavor, accent: str): """ Recolor the theme. currently hard code it frappe @@ -29,6 +75,7 @@ def recolor(flavor, accent: str): print("Recoloring accents") recolor_accent(flavor, accent) + recolor_firefox(flavor, accent) print("MOD: Gtkrc.sh") replacetext(f"{work_dir}/gtkrc.sh", "background_light='#FFFFFF'",