feat: add build CI
This commit is contained in:
28
.github/workflows/release.yml
vendored
Normal file
28
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: "GTK theme release"
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
cache: 'pip'
|
||||
- name: Install dependencies
|
||||
run: pip install -r requirements.txt
|
||||
- name: Generate themes
|
||||
run: python ./build.py
|
||||
- name: Add zips to release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: ./releases/*.zip
|
||||
@@ -64,7 +64,7 @@ With your favourite AUR helper, install them:
|
||||
|
||||
Clone the repository using
|
||||
```bash
|
||||
git clone --recurse-submodules git@github.com:npv12/gtk.git
|
||||
git clone --recurse-submodules git@github.com:catppuccin/gtk.git
|
||||
virtualenv -p python3 venv # to be created only once and only if you need a virtual env
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
|
||||
17
build.py
17
build.py
@@ -1,8 +1,17 @@
|
||||
import shutil
|
||||
from zipfile import ZipFile
|
||||
|
||||
from scripts.create_theme import create_theme
|
||||
from scripts.ctp_colors import ctp_colors, get_all_accent
|
||||
from scripts.var import tmp_dir
|
||||
|
||||
for theme, value in ctp_colors.items():
|
||||
for accent, _ in get_all_accent(value).items():
|
||||
print("\n\n\nCreating theme for", theme, "with accent", accent)
|
||||
create_theme(theme, accent)
|
||||
for flavor, value in ctp_colors.items():
|
||||
for accent in get_all_accent(value).keys():
|
||||
print("\n\n\nCreating theme for", flavor, "with accent", accent)
|
||||
filename = tmp_dir + '/' + create_theme(flavor, accent)
|
||||
filenames = [filename, filename + '-xhdpi', filename + '-hdpi']
|
||||
|
||||
with ZipFile(filename + '.zip', 'w') as zip:
|
||||
for filename in filenames:
|
||||
zip.write(filename)
|
||||
shutil.rmtree(filename)
|
||||
|
||||
@@ -7,9 +7,9 @@ ctp_colors = {
|
||||
"macchiato": Flavour.macchiato()
|
||||
}
|
||||
|
||||
def get_all_accent(color):
|
||||
def get_all_accent(flavor):
|
||||
accent = {}
|
||||
for key, value in color.__dict__.items():
|
||||
for key, value in flavor.__dict__.items():
|
||||
if key not in ['white', 'black', 'text', 'subtext0', 'subtext1', 'overlay0', 'overlay1', 'overlay2', 'surface0', 'surface1', 'surface2', 'base', 'mantle', 'crust']:
|
||||
accent[key] = value
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ from .var import (def_accent_dark, def_accent_light, def_color_map, src_dir,
|
||||
theme_name, work_dir)
|
||||
|
||||
|
||||
def recolor_accent(color, file: str, accent: str = "blue"):
|
||||
def recolor_accent(flavor, file: str, accent: str = "blue"):
|
||||
"""
|
||||
Recolors the accent color in a file.
|
||||
color:
|
||||
The color scheme to recolor to. Like mocha, frappe, latte, etc.
|
||||
flavor:
|
||||
The flavor to recolor to. Like mocha, frappe, latte, etc.
|
||||
file:
|
||||
The file to modify
|
||||
accent:
|
||||
@@ -23,13 +23,13 @@ def recolor_accent(color, file: str, accent: str = "blue"):
|
||||
file, def_accent_light[def_color_map[accent]], value.hex)
|
||||
|
||||
# Recolor as per base for dark theme.
|
||||
for key, value in color.__dict__.items():
|
||||
for key, value in flavor.__dict__.items():
|
||||
if key == accent:
|
||||
replacetext(
|
||||
file, def_accent_dark[def_color_map[accent]], value.hex)
|
||||
|
||||
|
||||
def recolor(color, accent: str):
|
||||
def recolor(flavor, accent: str):
|
||||
"""
|
||||
Recolor the theme. currently hard code it frappe
|
||||
"""
|
||||
@@ -38,47 +38,47 @@ def recolor(color, accent: str):
|
||||
|
||||
print("MOD: Gtkrc.sh")
|
||||
# Recolor as per accent for dark
|
||||
recolor_accent(color, f"{work_dir}/gtkrc.sh", accent)
|
||||
recolor_accent(flavor, f"{work_dir}/gtkrc.sh", accent)
|
||||
|
||||
replacetext(f"{work_dir}/gtkrc.sh", "background_light='#FFFFFF'",
|
||||
f"background_light='#{Flavour.latte().base.hex}'") # use latte_base for background_light
|
||||
replacetext(f"{work_dir}/gtkrc.sh", "background_dark='#0F0F0F'",
|
||||
f"background_dark='#{color.base.hex}'")
|
||||
f"background_dark='#{flavor.base.hex}'")
|
||||
replacetext(f"{work_dir}/gtkrc.sh", "background_darker='#121212'",
|
||||
f"background_darker='#{color.mantle.hex}'")
|
||||
f"background_darker='#{flavor.mantle.hex}'")
|
||||
replacetext(f"{work_dir}/gtkrc.sh",
|
||||
"background_alt='#212121'", f"background_alt='#{color.crust.hex}'")
|
||||
"background_alt='#212121'", f"background_alt='#{flavor.crust.hex}'")
|
||||
replacetext(f"{work_dir}/gtkrc.sh", "titlebar_light='#F2F2F2'",
|
||||
f"titlebar_light='#{Flavour.latte().crust.hex}'") # use latte_crust for titlebar_light
|
||||
replacetext(f"{work_dir}/gtkrc.sh", "titlebar_dark='#030303'",
|
||||
f"titlebar_dark='#{color.crust.hex}'")
|
||||
f"titlebar_dark='#{flavor.crust.hex}'")
|
||||
replacetext(f"{work_dir}/gtkrc.sh", "background_dark='#2C2C2C'",
|
||||
f"background_dark='#{color.base.hex}'")
|
||||
f"background_dark='#{flavor.base.hex}'")
|
||||
replacetext(f"{work_dir}/gtkrc.sh", "background_darker='#3C3C3C'",
|
||||
f"background_darker='#{color.mantle.hex}'")
|
||||
f"background_darker='#{flavor.mantle.hex}'")
|
||||
replacetext(f"{work_dir}/gtkrc.sh",
|
||||
"background_alt='#464646'", f"background_alt='#{color.crust.hex}'")
|
||||
"background_alt='#464646'", f"background_alt='#{flavor.crust.hex}'")
|
||||
replacetext(f"{work_dir}/gtkrc.sh",
|
||||
"titlebar_light='#F2F2F2'", f"titlebar_light='#{Flavour.latte().crust.hex}'")
|
||||
replacetext(f"{work_dir}/gtkrc.sh",
|
||||
"titlebar_dark='#242424'", f"titlebar_dark='#{color.crust.hex}'")
|
||||
"titlebar_dark='#242424'", f"titlebar_dark='#{flavor.crust.hex}'")
|
||||
|
||||
print("Mod SASS Color_Palette_default")
|
||||
recolor_accent(
|
||||
color, f"{src_dir}/sass/_color-palette-default.scss", accent)
|
||||
flavor, f"{src_dir}/sass/_color-palette-default.scss", accent)
|
||||
|
||||
# Greys
|
||||
if color == Flavour.latte(): # Hardcode till someone smarter than me comes along
|
||||
if flavor == Flavour.latte(): # Hardcode till someone smarter than me comes along
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-050: #FAFAFA", f"grey-050: #{color.crust.hex}")
|
||||
"grey-050: #FAFAFA", f"grey-050: #{flavor.crust.hex}")
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-100: #F2F2F2", f"grey-100: #{color.mantle.hex}")
|
||||
"grey-100: #F2F2F2", f"grey-100: #{flavor.mantle.hex}")
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-150: #EEEEEE", f"grey-150: #{color.base.hex}")
|
||||
"grey-150: #EEEEEE", f"grey-150: #{flavor.base.hex}")
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-200: #DDDDDD", f"grey-200: #{color.surface0.hex}") # Surface 0 Late
|
||||
"grey-200: #DDDDDD", f"grey-200: #{flavor.surface0.hex}") # Surface 0 Late
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-250: #CCCCCC", f"grey-250: #{color.surface1.hex}") # D = Surface 1 Late
|
||||
"grey-250: #CCCCCC", f"grey-250: #{flavor.surface1.hex}") # D = Surface 1 Late
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-650: #3C3C3C", f"grey-650: #{Flavour.mocha().surface0.hex}") # H $surface $tooltip
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss", "grey-700: #2C2C2C",
|
||||
@@ -95,47 +95,47 @@ def recolor(color, accent: str):
|
||||
"grey-950: #030303", f"grey-950: #{Flavour.mocha().crust.hex}") # F Darknes
|
||||
else:
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-050: #FAFAFA", f"grey-050: #{color.overlay2.hex}")
|
||||
"grey-050: #FAFAFA", f"grey-050: #{flavor.overlay2.hex}")
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-100: #F2F2F2", f"grey-100: #{color.overlay1.hex}")
|
||||
"grey-100: #F2F2F2", f"grey-100: #{flavor.overlay1.hex}")
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-150: #EEEEEE", f"grey-150: #{color.overlay0.hex}")
|
||||
"grey-150: #EEEEEE", f"grey-150: #{flavor.overlay0.hex}")
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-200: #DDDDDD", f"grey-200: #{color.surface2.hex}") # Surface 0 Late
|
||||
"grey-200: #DDDDDD", f"grey-200: #{flavor.surface2.hex}") # Surface 0 Late
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-250: #CCCCCC", f"grey-250: #{color.surface1.hex}") # D = Surface 1 Late
|
||||
"grey-250: #CCCCCC", f"grey-250: #{flavor.surface1.hex}") # D = Surface 1 Late
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-650: #3C3C3C", f"grey-650: #{color.surface0.hex}") # H $surface $tooltip
|
||||
"grey-650: #3C3C3C", f"grey-650: #{flavor.surface0.hex}") # H $surface $tooltip
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss", "grey-700: #2C2C2C",
|
||||
f"grey-700: #{color.base.hex}") # G $background; $base; titlebar-backdrop; $popover
|
||||
f"grey-700: #{flavor.base.hex}") # G $background; $base; titlebar-backdrop; $popover
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-750: #242424", f"grey-750: #{color.crust.hex}") # F $base-alt
|
||||
"grey-750: #242424", f"grey-750: #{flavor.crust.hex}") # F $base-alt
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-800: #212121", f"grey-800: #{color.crust.hex}") # E $panel-solid;p
|
||||
"grey-800: #212121", f"grey-800: #{flavor.crust.hex}") # E $panel-solid;p
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-850: #121212", f"grey-850: #{color.surface1.hex}") # H Darknes
|
||||
"grey-850: #121212", f"grey-850: #{flavor.surface1.hex}") # H Darknes
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-900: #0F0F0F", f"grey-900: #{color.base.hex}") # G Darknes
|
||||
"grey-900: #0F0F0F", f"grey-900: #{flavor.base.hex}") # G Darknes
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"grey-950: #030303", f"grey-950: #{color.crust.hex}") # F Darknes
|
||||
"grey-950: #030303", f"grey-950: #{flavor.crust.hex}") # F Darknes
|
||||
|
||||
# Buttons
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"button-close: #fd5f51", f"button-close: #{color.red.hex}")
|
||||
"button-close: #fd5f51", f"button-close: #{flavor.red.hex}")
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"button-max: #38c76a", f"button-max: #{color.green.hex}")
|
||||
"button-max: #38c76a", f"button-max: #{flavor.green.hex}")
|
||||
replacetext(f"{src_dir}/sass/_color-palette-default.scss",
|
||||
"button-min: #fdbe04", f"button-min: #{color.yellow.hex}")
|
||||
"button-min: #fdbe04", f"button-min: #{flavor.yellow.hex}")
|
||||
|
||||
print("Mod Accent Cinnamon")
|
||||
recolor_accent(color, f"{src_dir}/assets/cinnamon/make-assets.sh", accent)
|
||||
recolor_accent(flavor, f"{src_dir}/assets/cinnamon/make-assets.sh", accent)
|
||||
|
||||
print("Mod Accent Gnome shell")
|
||||
recolor_accent(
|
||||
color, f"{src_dir}/assets/gnome-shell/make-assets.sh", accent)
|
||||
flavor, f"{src_dir}/assets/gnome-shell/make-assets.sh", accent)
|
||||
|
||||
print("Mod Accent GTK")
|
||||
recolor_accent(color, f"{src_dir}/assets/gtk/make-assets.sh", accent)
|
||||
recolor_accent(flavor, f"{src_dir}/assets/gtk/make-assets.sh", accent)
|
||||
|
||||
print("Mod Accent GTK 2.0")
|
||||
recolor_accent(color, f"{src_dir}/assets/gtk-2.0/make-assets.sh", accent)
|
||||
recolor_accent(flavor, f"{src_dir}/assets/gtk-2.0/make-assets.sh", accent)
|
||||
|
||||
Reference in New Issue
Block a user