Compare commits

..

14 Commits

Author SHA1 Message Date
nullishamy
7f05c31d3e fix: daArKrDaRkdarkdark 2024-05-18 23:36:08 +01:00
nullishamy
bc140eefe4 fix: allow skipping of patch procedures 2024-05-18 23:19:58 +01:00
nullishamy
043ff54ad0 ci: don't explode the ci 2024-05-18 22:41:27 +01:00
nullishamy
e18e098571 fix: allow all accents to be generated in 1 task 2024-05-18 22:41:21 +01:00
nullishamy
ab13e83374 ci: whoops 2024-05-18 22:28:40 +01:00
nullishamy
aa86808ac7 ci: adapt to new build system 2024-05-18 22:25:33 +01:00
nullishamy
f31af15412 feat: zipping 2024-05-18 22:25:27 +01:00
nullishamy
1585bdacf7 feat: actually use our palette 2024-05-18 22:08:47 +01:00
nullishamy
41858b3d68 style: refactor the whole build script 2024-05-18 21:30:42 +01:00
nullishamy
c935fdec51 fix: naming; xfwm4; remove todos 2024-05-18 20:13:22 +01:00
nullishamy
2eca1a605f feat: assets 2024-05-18 19:32:40 +01:00
nullishamy
3501174789 fix: suffixes 2024-05-14 17:13:43 +01:00
nullishamy
2becf63d9c fix: keys 2024-05-14 17:07:31 +01:00
nullishamy
6323311752 build: start new build system 2024-05-14 17:00:22 +01:00
37 changed files with 18754 additions and 1784 deletions

View File

@@ -25,24 +25,18 @@ body:
attributes: attributes:
label: How did you install the theme? label: How did you install the theme?
options: options:
- From release (install.py) - GitHub Release
- From release (manual installation) - AUR Package
- From source (build.py) - catppuccin/nix
- Nix (nixpkgs / catppuccin/nix) - Nixpkgs
- AUR package - Flatpak
- From source (Python script)
validations: validations:
required: true required: true
- type: checkboxes
attributes:
label: Are you running the latest release, and if not does the issue persist there?
description: "Our latest release can be found under the [GitHub releases](https://github.com/catppuccin/gtk/releases/latest)"
options:
- label: I am running on the latest release & the issue persists there
required: true
- type: checkboxes - type: checkboxes
attributes: attributes:
label: If using GTK4, have you symlinked the "gtk-4.0" folder? label: If using GTK4, have you symlinked the "gtk-4.0" folder?
description: "The instructions for symlinking are described at the bottom of the [Manual Installation guide](https://github.com/catppuccin/gtk/tree/663f6c61f8cf1fcbbeb72110bf6b0a0214755245?tab=readme-ov-file#manual-installation)." description: "The instructions for symlinking are described in the [README](https://github.com/catppuccin/gtk/tree/877e75568c9bb0d57c7ddda85b246fa17af45e57?tab=readme-ov-file#for-gtk-4-users)."
options: options:
- label: I have symlinked the `gtk-4.0` folder. - label: I have symlinked the `gtk-4.0` folder.
required: false required: false

View File

@@ -1,35 +0,0 @@
name: "Generate test artifacts"
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Install colloid specific dependencies
run: sudo apt update && sudo apt install -y sassc inkscape optipng
- name: Generate themes
run: |
python patches/xfwm4/generate_assets.py
python ./build.py mocha --all-accents --zip -d $PWD/releases &&
python ./build.py macchiato --all-accents --zip -d $PWD/releases &&
python ./build.py frappe --all-accents --zip -d $PWD/releases &&
python ./build.py latte --all-accents --zip -d $PWD/releases
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: '${{ github.sha }}-artifacts'
path: ./releases/*.zip

View File

@@ -1,4 +1,4 @@
name: "Mainline release" name: "Release"
on: on:
push: push:
@@ -6,6 +6,9 @@ on:
- "v*" - "v*"
jobs: jobs:
release: release:
strategy:
matrix:
flavor: [mocha, macchiato, latte, frappe]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@@ -21,11 +24,7 @@ jobs:
- name: Install colloid specific dependencies - name: Install colloid specific dependencies
run: sudo apt update && sudo apt install -y sassc inkscape optipng run: sudo apt update && sudo apt install -y sassc inkscape optipng
- name: Generate themes - name: Generate themes
run: | run: python ./build.py ${{ matrix.flavor }} -a all --zip -d $PWD/releases
python ./build.py mocha --all-accents --zip -d $PWD/releases &&
python ./build.py macchiato --all-accents --zip -d $PWD/releases &&
python ./build.py frappe --all-accents --zip -d $PWD/releases &&
python ./build.py latte --all-accents --zip -d $PWD/releases
- name: Add zips to release - name: Add zips to release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:

View File

@@ -1,68 +0,0 @@
## Development
### Requirements
- All the [requirements for building](#building)
- `whiskers`, optionally, from [catppuccin/toolbox](https://github.com/catppuccin/toolbox/tree/main/whiskers#installation)
### Patching colloid
> [!TIP]
> If you need to change the patches, reset the submodule and rerun the build script.
We patch upstream colloid through a series of `.patch` files, applied through `git apply` once when the build begins.
The patches are located in `./patches/colloid/`.
Once the build script patches the submodule, it will write a file into
`colloid/.patched`, to signal to future invocations that the patches have already been applied.
The palette patches are generated through `whiskers`,
so if you're changing them, they will need regenerated. Simply run `whiskers palette.tera` to rebuild them.
The process for building the theme is [documented in the README](./README.md#building).
### Upstreaming procedure
Now and again, Colloid will have bugs upstream that impacts our theme. With our patching system we can easily fix these problems,
but we still want to contribute the fixes upstream to benefit all users & forks of Colloid.
To avoid stalling unnecessarily, our procedure for the above is as follows:
1) Open a PR to fix the issue, by adding a patch file to our theme, add `upstream:intended`
to signal these changes are to be sent to Colloid eventually.
2) Merge the PR & close the issue in our theme pertaining to the issue, once reviewed and approved
3) Open a PR in Colloid with the patch
4) Open a new issue in our theme, with these details:
- The initial issue in our theme
- The PR in Colloid that fixes the issue there
- The PR that fixed the issue in our theme
Add the `upstream:open` label
5) Once the PR is merged in Colloid:
1) Test that the issue no longer persists, without our patch
2) Open a PR to remove the patch file in our theme, with these details:
- The tracking issue
- The commit that fixed the issue in Colloid
3) Close the tracking issue & merge the PR to remove the patch file
### Running test builds
We support building and publishing test builds from PRs. When you open PRs, the CI will automatically build with your changes and push an artifact
which bundles all of the produced themes.
You can then download the artifacts as a zip (result should look similar to 7bff2448a81e36bf3b0e03bfbd649bebe6973ec7-artifacts.zip) and
pass the path into `install.py` under the `--from-artifact` option:
```bash
python3 install.py mocha blue --dest ./build --from-artifact ~/downloads/7bff2448a81e36bf3b0e03bfbd649bebe6973ec7-artifacts.zip
```
This will take the target flavor / accent out of the zip, and install it using the regular install process.
It is advised to pass a `--dest` when running in this mode, because the released zips follow the exact same naming scheme as regular builds.
This wil cause conflicts when you install, if you already had that theme installed. Passing a different destination allows you to move the
extracted folders to `~/.local/share/themes` yourself, adding a suffix as appropriate to avoid conflicts.
> [!WARNING]
> If you pass `--link` to the install script when working from a PR, it will forcibly overwrite your `~/.config/gtk-4.0/` symlinks.
> You will have to reinstall / relink to revert this.
### Useful resources
- GNOME-shell sources: https://gitlab.gnome.org/GNOME/gnome-shell/-/tree/gnome-46/data/theme
- GTK inspector guide: https://developer.gnome.org/documentation/tools/inspector.html

281
README.md
View File

@@ -1,70 +1,61 @@
<h3 align="center"> <h3 align="center">
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/logos/exports/1544x1544_circle.png" width="100" alt="Logo"/><br/> <img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/logos/exports/1544x1544_circle.png" width="100" alt="Logo"/><br/>
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/> <img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/>
Catppuccin for <a href="https://gtk.org/">GTK</a> Catppuccin for <a href="https://gtk.org/">GTK</a>
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/> <img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/>
</h3> </h3>
<p align="center"> <p align="center">
<a href="https://github.com/catppuccin/gtk/stargazers"><img src="https://img.shields.io/github/stars/catppuccin/gtk?colorA=363a4f&colorB=b7bdf8&style=for-the-badge"></a> <a href="https://github.com/catppuccin/gtk/stargazers"><img src="https://img.shields.io/github/stars/catppuccin/gtk?colorA=363a4f&colorB=b7bdf8&style=for-the-badge"></a>
<a href="https://github.com/catppuccin/gtk/issues"><img src="https://img.shields.io/github/issues/catppuccin/gtk?colorA=363a4f&colorB=f5a97f&style=for-the-badge"></a> <a href="https://github.com/catppuccin/gtk/issues"><img src="https://img.shields.io/github/issues/catppuccin/gtk?colorA=363a4f&colorB=f5a97f&style=for-the-badge"></a>
<a href="https://github.com/catppuccin/gtk/contributors"><img src="https://img.shields.io/github/contributors/catppuccin/gtk?colorA=363a4f&colorB=a6da95&style=for-the-badge"></a> <a href="https://github.com/catppuccin/gtk/contributors"><img src="https://img.shields.io/github/contributors/catppuccin/gtk?colorA=363a4f&colorB=a6da95&style=for-the-badge"></a>
</p> </p>
<p align="center"> <p align="center">
<img src="assets/res.webp"/> <img src="assets/res.webp"/>
</p> </p>
This GTK theme is based on the [Colloid](https://github.com/vinceliuice/Colloid-gtk-theme) theme made by [vinceliuice](https://github.com/vinceliuice) # About
## Installation This GTK theme is based on the [Colloid](https://github.com/vinceliuice/Colloid-gtk-theme) theme made by [Vinceliuice](https://github.com/vinceliuice)
This GTK theme requires: ## Usage
### Requirements
- GTK `>=3.20` - GTK `>=3.20`
- Python 3+ - `gnome-themes-extra` (or `gnome-themes-standard`)
### Automated script ### Installation
We provide a Python script to automate the process of installing the theme: 1. Download and extract the theme zip from [releases](https://github.com/catppuccin/gtk/releases/).
2. Move the theme folder to **".themes"** in your home directory. **(~/.themes)** (Skip this step if you are using the AUR package)
3. Select the downloaded theme via your desktop specific tweaks application (**gnome-tweaks** on Gnome 3+).
### For Arch Linux users
We have 4 AUR packages for all the 4 flavours of the theme:
- [Latte](https://aur.archlinux.org/packages/catppuccin-gtk-theme-latte)
- [Frappe](https://aur.archlinux.org/packages/catppuccin-gtk-theme-frappe)
- [Macchiato](https://aur.archlinux.org/packages/catppuccin-gtk-theme-macchiato)
- [Mocha](https://aur.archlinux.org/packages/catppuccin-gtk-theme-mocha)
With your favourite AUR helper, install them:
```bash ```bash
curl -LsS "https://raw.githubusercontent.com/catppuccin/gtk/main/install.py" -o install.py yay -S catppuccin-gtk-theme-mocha catppuccin-gtk-theme-macchiato catppuccin-gtk-theme-frappe catppuccin-gtk-theme-latte
python3 install.py <flavor> <accent>
[catppuccin-gtk] [INFO] - Installation info:
flavor: mocha
accent: blue
dest: /home/<user>/.local/share/themes
link: False
remote_url: https://github.com/catppuccin/gtk/releases/download/v1.0.0-alpha/catppuccin-mocha-blue-standard+default.zip
[catppuccin-gtk] [INFO] - Starting download...
[catppuccin-gtk] [INFO] - Response status: 200
[catppuccin-gtk] [INFO] - Download finished, zip is valid
[catppuccin-gtk] [INFO] - Verifying download..
[catppuccin-gtk] [INFO] - Download verified
[catppuccin-gtk] [INFO] - Extracting...
[catppuccin-gtk] [INFO] - Extraction complete
[catppuccin-gtk] [INFO] - Theme installation complete!
``` ```
### Arch Linux ### For Nix users
With your favourite AUR helper, you can install your flavor of choice: We suggest you use [catppuccin/nix](https://github.com/catppuccin/nix).
Alternatively, you can use [catppuccin-gtk](https://github.com/NixOS/nixpkgs/blob/master/pkgs/data/themes/catppuccin-gtk/default.nix) from nixpkgs.
```bash
yay -S catppuccin-gtk-theme-<flavor>
paru -S catppuccin-gtk-theme-<flavor>
```
### Nix
We have created a Nix module ([catppuccin/nix](https://github.com/catppuccin/nix)) for theming apps under Nix, and recommend that you use it.
You can set up our Nix module for GTK with the following config:
```nix ```nix
{inputs, ...}: { {inputs, ...}: {
imports = [inputs.catppuccin.homeManagerModules.catppuccin]; imports = [inputs.catppuccin.homeManagerModules.catppuccin];
gtk = { gtk = {
enable = true; enable = true;
catppuccin = { catppuccin = {
@@ -79,100 +70,150 @@ You can set up our Nix module for GTK with the following config:
``` ```
> [!TIP] > [!TIP]
> For further information on the options available with our module, see the [full documentation](https://github.com/catppuccin/nix/blob/main/docs/home-manager-options.md#gtkcatppuccinenable). > For further information on the options available, see the [full documentation](https://github.com/catppuccin/nix/blob/main/docs/home-manager-options.md#gtkcatppuccinenable).
Alternatively, if you are not using our Nix module, you can grab the theme from [nixpkgs/catppuccin-gtk](https://github.com/NixOS/nixpkgs/blob/master/pkgs/data/themes/catppuccin-gtk/default.nix) ### For GTK 4 users
## Flatpak To theme GTK 4 applications you have to manually symlink the `~/.config/gtk-4.0/` to the themes folder. Use the following commands
Flatpak by default restricts access to themes, to allow access, use the following:
```bash
sudo flatpak override --filesystem=$HOME/.local/share/themes
```
After you've allowed access, set the theme, using the following:
```bash
# Change to suite your flavor / accent combination
export FLAVOR="mocha"
export ACCENT="mauve"
# Set the theme
sudo flatpak override --env=GTK_THEME="catppuccin-${FLAVOR}-${ACCENT}-standard+default"
```
### Manual installation
If your distro does not package our theme, and the installation script will not work for your use case, you can pull down releases and extract them yourself. You can find the [latest release on GitHub](https://github.com/catppuccin/gtk/releases/latest).
```bash ```bash
cd ~/.local/share/themes mkdir -p "${HOME}/.config/gtk-4.0"
ln -sf "${THEME_DIR}/gtk-4.0/assets" "${HOME}/.config/gtk-4.0/assets"
# Set the root URL ln -sf "${THEME_DIR}/gtk-4.0/gtk.css" "${HOME}/.config/gtk-4.0/gtk.css"
export ROOT_URL="https://https://github.com/catppuccin/gtk/releases/download"
# Change to the tag you want to download
export RELEASE="v1.0.0"
# Change to suite your flavor / accent combination
export FLAVOR="mocha"
export ACCENT="mauve"
curl -LsS "${ROOT_URL}/${RELEASE}/catppuccin-${FLAVOR}-${ACCENT}-standard+default.zip"
# Extract the catppuccin zip file
unzip catppuccin-${FLAVOR}-${ACCENT}-standard+default.zip
# Set the catppuccin theme directory
export THEME_DIR="$HOME/.local/share/themes/catppuccin-${FLAVOR}-${ACCENT}-standard+default"
# Optionally, add support for libadwaita
mkdir -p "${HOME}/.config/gtk-4.0" &&
ln -sf "${THEME_DIR}/gtk-4.0/assets" "${HOME}/.config/gtk-4.0/assets" &&
ln -sf "${THEME_DIR}/gtk-4.0/gtk.css" "${HOME}/.config/gtk-4.0/gtk.css" &&
ln -sf "${THEME_DIR}/gtk-4.0/gtk-dark.css" "${HOME}/.config/gtk-4.0/gtk-dark.css" ln -sf "${THEME_DIR}/gtk-4.0/gtk-dark.css" "${HOME}/.config/gtk-4.0/gtk-dark.css"
``` ```
## Building ### For Flatpak users
If our prebuilt offerings do not match your requirements, you will have to build the theme from source. 1. To give your Flatpaks access to your themes folder run:
### Requirements
- Python 3+
- `sassc`, the Sass compiler
- `inkscape`, `optipng`, for rendering PNGs
> [!WARNING]
> We use a submodule to bring in colloid, the theme this theme is based on. You will need to clone
> with `git clone <url> --recurse-submodules` to bring in the submodule.
To build the theme, simply invoke `build.py`:
```bash ```bash
python3 build.py mocha --dest ./build -a rosewater --tweaks rimless sudo flatpak override --filesystem=$HOME/.themes
[catppuccin-gtk] [INFO] - Patches seem to be applied, remove "colloid/.patched" to force application (this may fail)
[catppuccin-gtk] [INFO] - Building temp tweaks file
[catppuccin-gtk] [INFO] - Inserting gnome-shell imports
[catppuccin-gtk] [INFO] - Building main theme
[catppuccin-gtk] [INFO] - Build info:
build_root: ./build
theme_name: catppuccin
flavor: mocha
accent: rosewater
size: standard
tweaks: Tweaks(tweaks=['rimless'])
[catppuccin-gtk] [INFO] - Building into './build/catppuccin-mocha-rosewater-standard+rimless'...
[catppuccin-gtk] [INFO] - Main build complete
[catppuccin-gtk] [INFO] - Bundling assets...
[catppuccin-gtk] [INFO] - Asset bundling done
[catppuccin-gtk] [INFO] - Done!
``` ```
You can now find the built theme under `./build`. If you want to package the theme up as a zip instead, pass `--zip` to the build script. 2. To set the theme for all Flatpaks, replace `##theme##` with the name of the theme you want to use and run this command:
```bash
sudo flatpak override --env=GTK_THEME=##theme##
```
3. For a more in depth tutorial see Hamza Algohary's tutorial on [It's FOSS](https://itsfoss.com/flatpak-app-apply-theme/)
### Handling GTK theme installation from window manager
1. Install unzip and curl.
2. Go to your window manager config file.
3. Add an entrance to the config file to be executed when your window manager is loaded.
- i3/sway example:
```
# catppuccin
set $ctp-version v0.6.1
exec_always if [ ! -e ~/.themes/Catppuccin-Frappe-Standard-Lavender-dark ]; then \
mkdir -p ~/.themes \
&& curl -L https://github.com/catppuccin/gtk/releases/download/$ctp-version/Catppuccin-Frappe-Standard-Lavender-dark.zip -o ~/.themes/catppuccin.zip \
&& unzip ~/.themes/catppuccin.zip -d ~/.themes/ \
&& rm -rf ~/.themes/catppuccin.zip; fi
```
> Note: The previous example execute that script every time i3/sway is reloaded.
4. Set the GTK_THEME environment variable:
```sh
export GTK_THEME='Catppuccin-Frappe-Standard-Lavender-dark:dark'
```
> [!NOTE]
> in order to update the theme's version, just change the variable `$ctp-version`.
### GDM Theme
> [!WARNING]
> Applying a custom theme to GDM is not recommended as it is not themeable, however you can do it through certain *hacks*.
To apply the theme to GDM, A new `gnome-shell-theme.gresource.xml` needs to be complied.
To achieve this, you can run the following:
```bash
# Backup the current gresource file.
sudo cp -av /usr/share/gnome-shell/gnome-shell-theme.gresource{,~}
sudo glib-compile-resources --target="/usr/share/gnome-shell/gnome-shell-theme.gresource" --sourcedir="$THEME_DIR" "$THEME_DIR/gnome-shell-theme.gresource.xml"
```
Make sure to replace `$THEME_DIR` to where the theme was extracted accordingly.
- For nix users, it'll be the nix store path of the package.
- For AUR users, it'll be in `~/.themes`
- Otherwise, it'll be wherever you extracted the theme.
### Using the script
**Note**: Ensure that you have at least Python version 3.10 installed
Set up the installer using
```bash
git clone --recurse-submodules git@github.com:catppuccin/gtk.git
cd gtk
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
```
To check out the install script, run
```bash
python install.py --help
```
> Tip: `python install.py --help` allows the following options:
```
Compulsory field Specify color variant(s) [mocha|frappe|macchiato|latte|all]
-d, --dest DIR Specify destination directory (Default: ~/.themes)
-n, --name NAME Specify theme name (Default: Colloid)
-a, --accent VARIANT... Specify theme color variant(s) [rosewater|flamingo|pink|mauve|red|maroon|peach|yellow|green|teal|sky|
sapphire|blue|lavender|all] (Default: blue)
-s, --size VARIANT... Specify size variant [standard|compact] (Default: standard variant)
-l, --link Link installed gtk-4.0 theme to config folder for all libadwaita app use this theme
--zip Zips up the finally produced themes.
--tweaks Specify versions for tweaks [black|rimless|normal|float]
1. black: Blackness color version
2. rimless: Remove the 1px border about windows and menus
3. normal: Normal windows button style (titlebuttons: max/min/close)
4. float: Floating gnome-shell panel style
-h, --help Show help
```
You can install any theme like the following example
```bash
python install.py mocha -a sky --tweaks rimless -d ~/.themes
```
You can build all possible variations of the theme possible using the following command and it will install it to releases folder
```bash
python install.py all -a all
```
## Development
You need to install the following packages to build the theme. Check with your distribution for the package names in the repository
- `sassc`
- `inkscape`
- `optipng`
A few important notes to keep in mind
- `recolor.py` handles all changes that needs to be done to colloid to ensure it generated catppuccin colors. If vinceliuice changes anything in his theme in future, that is where you must change
- `var.py` includes all different variables that you can tinker around as per your personal requirements.
- `create_theme.py` consists of a wrapper that will recolor the colloid theme, install it as per the args provided and rename it accordingly.
## 💝 Thanks to ## 💝 Thanks to
**Current maintainers** **Current maintainers**
- [nullishamy](https://github.com/nullishamy)
- [npv12](https://github.com/npv12) - [npv12](https://github.com/npv12)
- [ghostx31](https://github.com/ghostx31) - [ghostx31](https://github.com/ghostx31)
- [Syndrizzle](https://github.com/Syndrizzle) - [Syndrizzle](https://github.com/Syndrizzle)
@@ -180,7 +221,7 @@ You can now find the built theme under `./build`. If you want to package the the
**Contributions** **Contributions**
- [rubyowo](https://github.com/rubyowo) - CI and docs - [rubyowo](https://github.com/rubyowo) - CI and docs
- [braheezy](https://github.com/braheezy) - Instructions for the GDM theme - [braheezy](https://github.com/braheezy) - Instructions for the GDM theme.
**Previous maintainer(s)** **Previous maintainer(s)**

252
build.py
View File

@@ -1,8 +1,8 @@
#!/usr/bin/env python3 #! /usr/bin/env python3
import os, re, shutil, subprocess, argparse, glob, logging, zipfile, sys import os, re, shutil, subprocess, argparse, glob, logging, zipfile
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any, Literal, List from typing import Literal, List
from catppuccin import PALETTE from catppuccin import PALETTE
from catppuccin.models import Flavor, Color from catppuccin.models import Flavor, Color
@@ -30,20 +30,6 @@ class Tweaks:
return ",".join(self.tweaks) return ",".join(self.tweaks)
@dataclass
class Suffix:
true_value: str
test: Any # callback function
false_value: str = ""
IS_DARK = Suffix(true_value="-Dark", test=lambda ctx: ctx.flavor.dark)
IS_LIGHT = Suffix(true_value="-Light", test=lambda ctx: not ctx.flavor.dark)
IS_WINDOW_NORMAL = Suffix(true_value="-Normal", test=lambda ctx: ctx.tweaks.has('normal'))
DARK_LIGHT = Suffix(
true_value="-Dark", false_value="-Light", test=lambda ctx: ctx.flavor.dark
)
@dataclass @dataclass
class BuildContext: class BuildContext:
build_root: str build_root: str
@@ -60,15 +46,26 @@ class BuildContext:
def build_id(self) -> str: def build_id(self) -> str:
return f"{self.theme_name}-{self.flavor.identifier}-{self.accent.identifier}-{self.size}+{self.tweaks.id() or 'default'}" return f"{self.theme_name}-{self.flavor.identifier}-{self.accent.identifier}-{self.size}+{self.tweaks.id() or 'default'}"
def apply_suffix(self, suffix: Suffix) -> str:
if suffix.test(self):
return suffix.true_value
else:
return suffix.false_value
def build(ctx: BuildContext): def build(ctx: BuildContext):
dark_suffix = ""
light_suffix = ""
window_suffix = ""
scheme_suffix = "-Catppuccin"
if ctx.tweaks.has("normal"):
window_suffix = "-Normal"
if ctx.flavor == "latte":
light_suffix = "-Light"
suffix = "-Light"
if ctx.flavor != "":
dark_suffix = "-Dark"
suffix = "-Dark"
output_dir = ctx.output_dir() output_dir = ctx.output_dir()
# [[ -d "${THEME_DIR}" ]] && rm -rf "${THEME_DIR}"
logger.info(f"Building into '{output_dir}'...") logger.info(f"Building into '{output_dir}'...")
apply_tweaks(ctx) apply_tweaks(ctx)
@@ -84,7 +81,7 @@ def build(ctx: BuildContext):
file.write("[X-GNOME-Metatheme]\n") file.write("[X-GNOME-Metatheme]\n")
file.write(f"GtkTheme={ctx.build_id()}\n") file.write(f"GtkTheme={ctx.build_id()}\n")
file.write(f"MetacityTheme={ctx.build_id()}\n") file.write(f"MetacityTheme={ctx.build_id()}\n")
file.write(f"IconTheme=Tela-circle{ctx.apply_suffix(IS_DARK)}\n") file.write(f"IconTheme=Tela-circle{dark_suffix}\n")
file.write(f"CursorTheme={ctx.flavor.name}-cursors\n") file.write(f"CursorTheme={ctx.flavor.name}-cursors\n")
file.write("ButtonLayout=close,minimize,maximize:menu\n") file.write("ButtonLayout=close,minimize,maximize:menu\n")
@@ -97,7 +94,7 @@ def build(ctx: BuildContext):
[ [
"sassc", "sassc",
*SASSC_OPT, *SASSC_OPT,
f"{SRC_DIR}/main/gnome-shell/gnome-shell{ctx.apply_suffix(DARK_LIGHT)}.scss", f"{SRC_DIR}/main/gnome-shell/gnome-shell{suffix}.scss",
f"{output_dir}/gnome-shell/gnome-shell.css", f"{output_dir}/gnome-shell/gnome-shell.css",
] ]
) )
@@ -107,7 +104,7 @@ def build(ctx: BuildContext):
[ [
"sassc", "sassc",
*SASSC_OPT, *SASSC_OPT,
f"{SRC_DIR}/main/gtk-3.0/gtk{ctx.apply_suffix(DARK_LIGHT)}.scss", f"{SRC_DIR}/main/gtk-3.0/gtk{suffix}.scss",
f"{output_dir}/gtk-3.0/gtk.css", f"{output_dir}/gtk-3.0/gtk.css",
] ]
) )
@@ -115,9 +112,8 @@ def build(ctx: BuildContext):
[ [
"sassc", "sassc",
*SASSC_OPT, *SASSC_OPT,
# NOTE: This uses 'Dark' for the source, but 'dark' for the destination. This is intentional. Do !!NOT!! change it without consultation
f"{SRC_DIR}/main/gtk-3.0/gtk-Dark.scss", f"{SRC_DIR}/main/gtk-3.0/gtk-Dark.scss",
f"{output_dir}/gtk-3.0/gtk-dark.css", f"{output_dir}/gtk-3.0/gtk-Dark.css",
] ]
) )
@@ -126,7 +122,7 @@ def build(ctx: BuildContext):
[ [
"sassc", "sassc",
*SASSC_OPT, *SASSC_OPT,
f"{SRC_DIR}/main/gtk-4.0/gtk{ctx.apply_suffix(DARK_LIGHT)}.scss", f"{SRC_DIR}/main/gtk-4.0/gtk{suffix}.scss",
f"{output_dir}/gtk-4.0/gtk.css", f"{output_dir}/gtk-4.0/gtk.css",
] ]
) )
@@ -134,9 +130,8 @@ def build(ctx: BuildContext):
[ [
"sassc", "sassc",
*SASSC_OPT, *SASSC_OPT,
# NOTE: This uses 'Dark' for the source, but 'dark' for the destination. This is intentional. Do !!NOT!! change it without consultation
f"{SRC_DIR}/main/gtk-4.0/gtk-Dark.scss", f"{SRC_DIR}/main/gtk-4.0/gtk-Dark.scss",
f"{output_dir}/gtk-4.0/gtk-dark.css", f"{output_dir}/gtk-4.0/gtk-Dark.css",
] ]
) )
@@ -145,14 +140,22 @@ def build(ctx: BuildContext):
[ [
"sassc", "sassc",
*SASSC_OPT, *SASSC_OPT,
f"{SRC_DIR}/main/cinnamon/cinnamon{ctx.apply_suffix(DARK_LIGHT)}.scss", f"{SRC_DIR}/main/cinnamon/cinnamon{suffix}.scss",
f"{output_dir}/cinnamon/cinnamon.css", f"{output_dir}/cinnamon/cinnamon.css",
] ]
) )
subprocess.check_call(
[
"sassc",
*SASSC_OPT,
f"{SRC_DIR}/main/gtk-4.0/gtk-Dark.scss",
f"{output_dir}/gtk-4.0/gtk-Dark.css",
]
)
os.makedirs(f"{output_dir}/metacity-1", exist_ok=True) os.makedirs(f"{output_dir}/metacity-1", exist_ok=True)
shutil.copyfile( shutil.copyfile(
f"{SRC_DIR}/main/metacity-1/metacity-theme-3{ctx.apply_suffix(IS_WINDOW_NORMAL)}.xml", f"{SRC_DIR}/main/metacity-1/metacity-theme-3{window_suffix}.xml",
f"{output_dir}/metacity-1/metacity-theme-3.xml", f"{output_dir}/metacity-1/metacity-theme-3.xml",
) )
# FIXME: Symlinks aren't working as intended # FIXME: Symlinks aren't working as intended
@@ -168,20 +171,20 @@ def build(ctx: BuildContext):
os.makedirs(f"{output_dir}/xfwm4", exist_ok=True) os.makedirs(f"{output_dir}/xfwm4", exist_ok=True)
shutil.copyfile( shutil.copyfile(
f"{SRC_DIR}/main/xfwm4/themerc{ctx.apply_suffix(IS_LIGHT)}", f"{SRC_DIR}/main/xfwm4/themerc{light_suffix}",
f"{output_dir}/xfwm4/themerc", f"{output_dir}/xfwm4/themerc",
) )
os.makedirs(f"{output_dir}-hdpi/xfwm4", exist_ok=True) os.makedirs(f"{output_dir}-hdpi/xfwm4", exist_ok=True)
shutil.copyfile( shutil.copyfile(
f"{SRC_DIR}/main/xfwm4/themerc{ctx.apply_suffix(IS_LIGHT)}", f"{SRC_DIR}/main/xfwm4/themerc{light_suffix}",
f"{output_dir}-hdpi/xfwm4/themerc", f"{output_dir}-hdpi/xfwm4/themerc",
) )
subst_text(f"{output_dir}-hdpi/xfwm4/themerc", "button_offset=6", "button_offset=9") subst_text(f"{output_dir}-hdpi/xfwm4/themerc", "button_offset=6", "button_offset=9")
os.makedirs(f"{output_dir}-xhdpi/xfwm4", exist_ok=True) os.makedirs(f"{output_dir}-xhdpi/xfwm4", exist_ok=True)
shutil.copyfile( shutil.copyfile(
f"{SRC_DIR}/main/xfwm4/themerc{ctx.apply_suffix(IS_LIGHT)}", f"{SRC_DIR}/main/xfwm4/themerc{light_suffix or ''}",
f"{output_dir}-xhdpi/xfwm4/themerc", f"{output_dir}-xhdpi/xfwm4/themerc",
) )
subst_text( subst_text(
@@ -190,15 +193,15 @@ def build(ctx: BuildContext):
if not ctx.flavor.dark: if not ctx.flavor.dark:
shutil.copytree( shutil.copytree(
f"{SRC_DIR}/main/plank/theme-Light-Catppuccin/", f"{output_dir}/plank", dirs_exist_ok=True f"{SRC_DIR}/main/plank/theme-Light{scheme_suffix}/", f"{output_dir}/plank"
) )
else: else:
shutil.copytree( shutil.copytree(
f"{SRC_DIR}/main/plank/theme-Dark-Catppuccin/", f"{output_dir}/plank", dirs_exist_ok=True f"{SRC_DIR}/main/plank/theme-Dark{scheme_suffix}/", f"{output_dir}/plank"
) )
def init_tweaks_temp(): def tweaks_temp():
shutil.copyfile(f"{SRC_DIR}/sass/_tweaks.scss", f"{SRC_DIR}/sass/_tweaks-temp.scss") shutil.copyfile(f"{SRC_DIR}/sass/_tweaks.scss", f"{SRC_DIR}/sass/_tweaks-temp.scss")
@@ -231,13 +234,38 @@ def gnome_shell_version():
f"@import 'extensions-{GS_VERSION}';", f"@import 'extensions-{GS_VERSION}';",
) )
# Accent translation
ctp_to_colloid = {
"rosewater": "pink",
"flamingo": "pink",
"pink": "pink",
"mauve": "purple",
"red": "red",
"maroon": "red",
"peach": "orange",
"yellow": "yellow",
"green": "green",
"teal": "teal",
"sky": "teal",
"sapphire": "default",
"blue": "default",
"lavender": "default",
}
def translate_accent(ctp_accent: Color):
return ctp_to_colloid[ctp_accent.identifier]
def write_tweak(key, default, value): def write_tweak(key, default, value):
subst_text( subst_text(
f"{SRC_DIR}/sass/_tweaks-temp.scss", f"\\${key}: {default}", f"${key}: {value}" f"{SRC_DIR}/sass/_tweaks-temp.scss", f"\\${key}: {default}", f"${key}: {value}"
) )
def apply_tweaks(ctx: BuildContext): def apply_tweaks(ctx: BuildContext):
write_tweak("theme", "'default'", f"'{ctx.accent.identifier}'") write_tweak("theme", "'default'", translate_accent(ctx.accent))
if ctx.size == "compact": if ctx.size == "compact":
write_tweak("compact", "'false'", "'true'") write_tweak("compact", "'false'", "'true'")
@@ -263,13 +291,31 @@ def apply_tweaks(ctx: BuildContext):
def make_assets(ctx: BuildContext): def make_assets(ctx: BuildContext):
color_suffix = ""
if not ctx.flavor.dark:
color_suffix = "-Light"
else:
color_suffix = "-Dark"
dark_suffix = ""
if ctx.flavor.dark:
dark_suffix = "-Dark"
light_suffix = ""
if not ctx.flavor.dark:
light_suffix = "-Light"
window_suffix = ""
if ctx.tweaks.has("normal"):
window_suffix = "-Normal"
output_dir = ctx.output_dir() output_dir = ctx.output_dir()
os.makedirs(f"{output_dir}/cinnamon/assets", exist_ok=True) os.makedirs(f"{output_dir}/cinnamon/assets", exist_ok=True)
for file in glob.glob(f"{SRC_DIR}/assets/cinnamon/theme/*.svg"): for file in glob.glob(f"{SRC_DIR}/assets/cinnamon/theme/*.svg"):
shutil.copy(file, f"{output_dir}/cinnamon/assets") shutil.copy(file, f"{output_dir}/cinnamon/assets")
shutil.copy( shutil.copy(
f"{SRC_DIR}/assets/cinnamon/thumbnail{ctx.apply_suffix(DARK_LIGHT)}.svg", f"{SRC_DIR}/assets/cinnamon/thumbnail{color_suffix}.svg",
f"{output_dir}/cinnamon/thumbnail.png", f"{output_dir}/cinnamon/thumbnail.png",
) )
@@ -288,11 +334,11 @@ def make_assets(ctx: BuildContext):
dirs_exist_ok=True, dirs_exist_ok=True,
) )
shutil.copyfile( shutil.copyfile(
f"{SRC_DIR}/assets/gtk/thumbnail{ctx.apply_suffix(IS_DARK)}.svg", f"{SRC_DIR}/assets/gtk/thumbnail{dark_suffix}.svg",
f"{output_dir}/gtk-3.0/thumbnail.png", f"{output_dir}/gtk-3.0/thumbnail.png",
) )
shutil.copyfile( shutil.copyfile(
f"{SRC_DIR}/assets/gtk/thumbnail{ctx.apply_suffix(IS_DARK)}.svg", f"{SRC_DIR}/assets/gtk/thumbnail{dark_suffix}.svg",
f"{output_dir}/gtk-4.0/thumbnail.png", f"{output_dir}/gtk-4.0/thumbnail.png",
) )
@@ -348,36 +394,37 @@ def make_assets(ctx: BuildContext):
for file in glob.glob(f"{SRC_DIR}/assets/cinnamon/common-assets/*.svg"): for file in glob.glob(f"{SRC_DIR}/assets/cinnamon/common-assets/*.svg"):
shutil.copy(file, f"{output_dir}/cinnamon/assets") shutil.copy(file, f"{output_dir}/cinnamon/assets")
for file in glob.glob(f"{SRC_DIR}/assets/cinnamon/assets{ctx.apply_suffix(IS_DARK)}/*.svg"): for file in glob.glob(f"{SRC_DIR}/assets/cinnamon/assets-{dark_suffix}/*.svg"):
shutil.copy(file, f"{output_dir}/cinnamon/assets") shutil.copy(file, f"{output_dir}/cinnamon/assets")
for file in glob.glob(f"{SRC_DIR}/assets/gnome-shell/common-assets/*.svg"): for file in glob.glob(f"{SRC_DIR}/assets/gnome-shell/common-assets/*.svg"):
shutil.copy(file, f"{output_dir}/gnome-shell/assets") shutil.copy(file, f"{output_dir}/gnome-shell/assets")
for file in glob.glob(f"{SRC_DIR}/assets/gnome-shell/assets{ctx.apply_suffix(IS_DARK)}/*.svg"): for file in glob.glob(f"{SRC_DIR}/assets/gnome-shell/assets-{dark_suffix}/*.svg"):
shutil.copy(file, f"{output_dir}/gnome-shell/assets") shutil.copy(file, f"{output_dir}/gnome-shell/assets")
for file in glob.glob(f"{SRC_DIR}/assets/gtk/symbolics/*.svg"): for file in glob.glob(f"{SRC_DIR}/assets/gtk/symbolics/*.svg"):
shutil.copy(file, f"{output_dir}/gtk-3.0/assets") shutil.copy(file, f"{output_dir}/gtk-3.0/assets")
shutil.copy(file, f"{output_dir}/gtk-4.0/assets") shutil.copy(file, f"{output_dir}/gtk-4.0/assets")
for file in glob.glob(f"{SRC_DIR}/assets/metacity-1/assets{ctx.apply_suffix(IS_WINDOW_NORMAL)}/*.svg"): for file in glob.glob(f"{SRC_DIR}/assets/metacity-1/assets-{window_suffix}/*.svg"):
shutil.copy(file, f"{output_dir}/metacity-1/assets") shutil.copy(file, f"{output_dir}/metacity-1/assets")
shutil.copy( shutil.copy(
f"{SRC_DIR}/assets/metacity-1/thumbnail{ctx.apply_suffix(IS_DARK)}.png", f"{SRC_DIR}/assets/metacity-1/thumbnail{dark_suffix}.png",
f"{output_dir}/metacity-1/thumbnail.png", f"{output_dir}/metacity-1/thumbnail.png",
) )
xfwm4_assets = f"{THIS_DIR}/patches/xfwm4/generated/assets-catppuccin-{ctx.flavor.identifier}" # TODO: Make our own assets for this and patch them in with the patch system, then code it to be
for file in glob.glob(xfwm4_assets + '/*'): # {src_dir}/assets/xfwm4/assets{light_suffix}-Catppuccin/
# where assets-Light-Catppuccin will have latte
# nad assets-Catppuccin will have mocha or something
for file in glob.glob(f"{SRC_DIR}/assets/xfwm4/assets{light_suffix}/*.png"):
shutil.copy(file, f"{output_dir}/xfwm4") shutil.copy(file, f"{output_dir}/xfwm4")
xfwm4_assets = xfwm4_assets + "-hdpi/*" for file in glob.glob(f"{SRC_DIR}/assets/xfwm4/assets{light_suffix}-hdpi/*.png"):
for file in glob.glob(xfwm4_assets):
shutil.copy(file, f"{output_dir}-hdpi/xfwm4") shutil.copy(file, f"{output_dir}-hdpi/xfwm4")
xfwm4_assets = xfwm4_assets + "-xhdpi/*" for file in glob.glob(f"{SRC_DIR}/assets/xfwm4/assets{light_suffix}-xhdpi/*.png"):
for file in glob.glob(xfwm4_assets):
shutil.copy(file, f"{output_dir}-xhdpi/xfwm4") shutil.copy(file, f"{output_dir}-xhdpi/xfwm4")
@@ -451,7 +498,7 @@ def apply_colloid_patches():
for patch in [ for patch in [
"plank-dark.patch", "plank-dark.patch",
"plank-light.patch", "plank-light.patch",
"theme-func.patch", "sass-colors.patch",
"sass-palette-frappe.patch", "sass-palette-frappe.patch",
"sass-palette-mocha.patch", "sass-palette-mocha.patch",
"sass-palette-latte.patch", "sass-palette-latte.patch",
@@ -466,6 +513,7 @@ def apply_colloid_patches():
logger.info("Patching finished.") logger.info("Patching finished.")
def parse_args(): def parse_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument( parser.add_argument(
@@ -498,8 +546,7 @@ def parse_args():
"-a", "-a",
type=str, type=str,
default="mauve", default="mauve",
nargs='+', dest="accent",
dest="accents",
choices=[ choices=[
"rosewater", "rosewater",
"flamingo", "flamingo",
@@ -515,17 +562,11 @@ def parse_args():
"sapphire", "sapphire",
"blue", "blue",
"lavender", "lavender",
"all"
], ],
help="Accent of the theme.", help="Accent of the theme.",
) )
parser.add_argument(
"--all-accents",
help="Whether to build all accents",
dest="all_accents",
action="store_true",
)
parser.add_argument( parser.add_argument(
"--size", "--size",
"-s", "-s",
@@ -564,49 +605,63 @@ def parse_args():
return parser.parse_args() return parser.parse_args()
def main(): def main():
args = parse_args() args = parse_args()
if args.patch: if args.patch:
apply_colloid_patches() apply_colloid_patches()
if args.zip:
output_format = "zip"
else:
output_format = "dir"
tweaks = Tweaks(tweaks=args.tweaks)
palette = getattr(PALETTE, args.flavor) palette = getattr(PALETTE, args.flavor)
accents=[
"rosewater",
"flamingo",
"pink",
"mauve",
"red",
"maroon",
"peach",
"yellow",
"green",
"teal",
"sky",
"sapphire",
"blue",
"lavender",
]
accents = args.accents if args.accent == 'all':
if args.all_accents: for accent in accents:
accents = [ accent = getattr(palette.colors, accent)
"rosewater",
"flamingo",
"pink",
"mauve",
"red",
"maroon",
"peach",
"yellow",
"green",
"teal",
"sky",
"sapphire",
"blue",
"lavender",
]
for accent in accents: tweaks = Tweaks(tweaks=args.tweaks)
accent = getattr(palette.colors, accent)
if args.zip:
output_format = 'zip'
else:
output_format = 'dir'
ctx = BuildContext(
build_root=args.dest,
theme_name=args.name,
flavor=palette,
accent=accent,
size=args.size,
tweaks=tweaks,
output_format=output_format
)
tweaks_temp()
gnome_shell_version()
build_theme(ctx)
logger.info("Done!")
else:
accent = getattr(palette.colors, args.accent)
tweaks = Tweaks(tweaks=args.tweaks) tweaks = Tweaks(tweaks=args.tweaks)
if args.zip: if args.zip:
output_format = "zip" output_format = 'zip'
else: else:
output_format = "dir" output_format = 'dir'
ctx = BuildContext( ctx = BuildContext(
build_root=args.dest, build_root=args.dest,
theme_name=args.name, theme_name=args.name,
@@ -614,20 +669,19 @@ def main():
accent=accent, accent=accent,
size=args.size, size=args.size,
tweaks=tweaks, tweaks=tweaks,
output_format=output_format, output_format=output_format
) )
logger.info("Building temp tweaks file") logger.info("Building temp tweaks file")
init_tweaks_temp() tweaks_temp()
logger.info("Inserting gnome-shell imports") logger.info("Inserting gnome-shell imports")
gnome_shell_version() gnome_shell_version()
logger.info("Building main theme") logger.info("Building main theme")
build_theme(ctx) build_theme(ctx)
logger.info(f"Completed {palette.identifier} with {accent.identifier}") logger.info("Done!")
logger.info("Done!")
try: try:
main() main()
except Exception as e: except Exception as e:
logger.error("Something went wrong when building the theme:", exc_info=e) logger.error("Something went wrong when installing the theme:", exc_info=e)
sys.exit(1)

Submodule colloid updated: 1a13048ea1...1cf28eac20

41
flake.lock generated
View File

@@ -1,25 +1,58 @@
{ {
"nodes": { "nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1715961556, "lastModified": 1714495772,
"narHash": "sha256-+NpbZRCRisUHKQJZF3CT+xn14ZZQO+KjxIIanH3Pvn4=", "narHash": "sha256-BVkhvsIatul5lXMrnPvgKkpxL3zZGQlPbTgDlFJiYCo=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4a6b83b05df1a8bd7d99095ec4b4d271f2956b64", "rev": "c82cda9c0600a2785cda8e60962bcc9cc86862db",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View File

@@ -1,18 +1,17 @@
{ {
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = outputs = { self, nixpkgs, flake-utils, ... }:
{ nixpkgs, ... }: flake-utils.lib.eachDefaultSystem (system:
let let
forAllSystems = pkgs = import nixpkgs { inherit system; };
function: in
nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed ( {
system: function nixpkgs.legacyPackages.${system} devShells.default = import ./shell.nix { inherit pkgs; };
); }
in );
{
devShells = forAllSystems (pkgs: {
default = pkgs.callPackage ./shell.nix { };
});
};
} }

View File

@@ -1,212 +0,0 @@
#!/usr/bin/env python3
import os, zipfile, argparse, logging, io
from typing import Optional
from pathlib import Path
from dataclasses import dataclass
from urllib.request import urlopen, Request
from urllib.parse import urlparse
logger = logging.getLogger("catppuccin-gtk")
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
formatter = logging.Formatter("[%(name)s] [%(levelname)s] - %(message)s")
ch.setFormatter(formatter)
logger.addHandler(ch)
@dataclass
class InstallContext:
flavor: str
accent: str
dest: Path
link: bool
def build_info(self, include_url=True) -> str:
url = build_release_url(self)
info = f"""Installation info:
flavor: {self.flavor}
accent: {self.accent}
dest: {self.dest.absolute()}
link: {self.link}"""
if include_url:
info += f"\nremote_url: {url}"
return info
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"flavor",
type=str,
choices=["mocha", "frappe", "macchiato", "latte"],
help="Flavor of the theme to apply.",
)
parser.add_argument(
"accent",
type=str,
default="mauve",
choices=[
"rosewater",
"flamingo",
"pink",
"mauve",
"red",
"maroon",
"peach",
"yellow",
"green",
"teal",
"sky",
"sapphire",
"blue",
"lavender",
],
help="Accent of the theme.",
)
parser.add_argument(
"--from-artifact",
type=Path,
dest="from_artifact",
help="Install from an artifact instead of a mainline release, pass the artifact path (e.g 7bff2448a81e36bf3b0e03bfbd649bebe6973ec7-artifacts.zip)",
)
parser.add_argument(
"--dest",
"-d",
type=str,
dest="dest",
help="Destination of the files.",
)
parser.add_argument(
"--link",
help="Whether to add symlinks for libadwaita",
type=bool,
default=False,
action=argparse.BooleanOptionalAction,
)
return parser.parse_args()
def build_release_url(ctx: InstallContext) -> str:
root = "https://github.com/catppuccin/gtk/releases/latest/download"
zip_name = f"catppuccin-{ctx.flavor}-{ctx.accent}-standard+default.zip"
return f"{root}/{zip_name}"
def fetch_zip(url: str) -> Optional[zipfile.ZipFile]:
req = Request(url)
zip_file = None
logger.info("Starting download...")
with urlopen(req) as response:
logger.info(f"Response status: {response.status}")
zip_file = zipfile.ZipFile(io.BytesIO(response.read()))
logger.info("Download finished, zip is valid")
logger.info("Verifying download..")
first_bad_file = zip_file.testzip()
if first_bad_file is not None:
logger.error(f'Zip appears to be corrupt, first bad file is "{first_bad_file}"')
return None
logger.info("Download verified")
return zip_file
def add_libadwaita_links(ctx: InstallContext, rewrite: bool = False):
dir_name = (
ctx.dest / f"catppuccin-{ctx.flavor}-{ctx.accent}-standard+default" / "gtk-4.0"
).absolute()
gtk4_dir = (Path(os.path.expanduser("~")) / ".config" / "gtk-4.0").absolute()
os.makedirs(gtk4_dir, exist_ok=True)
logger.info("Adding symlinks for libadwaita")
logger.info(f"Root: {dir_name}")
logger.info(f"Target: {gtk4_dir}")
try:
if rewrite:
os.remove(gtk4_dir / "assets")
os.remove(gtk4_dir / "gtk.css")
os.remove(gtk4_dir / "gtk-dark.css")
except FileNotFoundError:
logger.debug("Ignoring FileNotFound in symlink rewrite")
os.symlink(dir_name / "assets", gtk4_dir / "assets")
os.symlink(dir_name / "gtk.css", gtk4_dir / "gtk.css")
os.symlink(dir_name / "gtk-dark.css", gtk4_dir / "gtk-dark.css")
def install(ctx: InstallContext):
url = build_release_url(ctx)
logger.info(ctx.build_info())
zip_file = fetch_zip(url)
if zip_file is None:
return
logger.info("Extracting...")
zip_file.extractall(ctx.dest)
logger.info("Extraction complete")
if ctx.link:
add_libadwaita_links(ctx)
def install_from_artifact(ctx: InstallContext, artifact_path: Path):
# Working from a pull request, special case it
logger.info(f"Extracting artifact from '{artifact_path}'")
artifacts = zipfile.ZipFile(artifact_path)
logger.info("Verifying artifact...")
first_bad_file = artifacts.testzip()
if first_bad_file is not None:
logger.error(f'Zip appears to be corrupt, first bad file is "{first_bad_file}"')
return None
logger.info("Artifact verified")
logger.info(ctx.build_info(False))
# The zip, inside the artifacts, that we want to pull out
zip_name = f"catppuccin-{ctx.flavor}-{ctx.accent}-standard+default.zip"
logger.info(f"Pulling '{zip_name}' from the artifacts")
info = artifacts.getinfo(zip_name)
logger.info("Extracting the artifact...")
artifact = zipfile.ZipFile(io.BytesIO(artifacts.read(info)))
artifact.extractall(ctx.dest)
logger.info("Extraction complete")
if ctx.link:
logger.info("Adding links (with rewrite)")
add_libadwaita_links(ctx, True)
logger.info("Links added")
def main():
args = parse_args()
dest = Path(os.path.expanduser("~")) / ".local" / "share" / "themes"
os.makedirs(dest, exist_ok=True)
if args.dest:
dest = Path(args.dest)
ctx = InstallContext(
flavor=args.flavor, accent=args.accent, dest=dest, link=args.link
)
if args.from_artifact:
install_from_artifact(ctx, args.from_artifact)
return
install(ctx)
logger.info("Theme installation complete!")
try:
main()
except Exception as e:
logger.error("Something went wrong when installing the theme:", exc_info=e)

View File

@@ -8,107 +8,70 @@ whiskers:
{%- set palette = flavor.colors -%} {%- set palette = flavor.colors -%}
diff --git a/src/sass/_color-palette-catppuccin-{{ flavor.identifier }}.scss b/src/sass/_color-palette-catppuccin-{{ flavor.identifier }}.scss diff --git a/src/sass/_color-palette-catppuccin-{{ flavor.identifier }}.scss b/src/sass/_color-palette-catppuccin-{{ flavor.identifier }}.scss
new file mode 100644 new file mode 100644
index 00000000..4ff0da0d index 00000000..8a905942
--- /dev/null --- /dev/null
+++ b/src/sass/_color-palette-catppuccin-{{ flavor.identifier }}.scss +++ b/src/sass/_color-palette-catppuccin-{{ flavor.identifier }}.scss
@@ -0,0 +1,87 @@ @@ -0,0 +1,72 @@
+ // Our accents
+ $rosewater: #{{ palette.rosewater.hex }};
+ $flamingo: #{{ palette.flamingo.hex }};
+ $pink: #{{ palette.pink.hex }};
+ $mauve: #{{ palette.mauve.hex }};
+ $red: #{{ palette.red.hex }};
+ $maroon: #{{ palette.maroon.hex }};
+ $peach: #{{ palette.peach.hex }};
+ $yellow: #{{ palette.yellow.hex }};
+ $green: #{{ palette.green.hex }};
+ $teal: #{{ palette.teal.hex }};
+ $sky: #{{ palette.sky.hex }};
+ $sapphire: #{{ palette.sapphire.hex }};
+ $blue: #{{ palette.blue.hex }};
+ $lavender: #{{ palette.lavender.hex }};
+// Default Theme Color Palette +// Default Theme Color Palette
+ +
+// Red +// Red
+$red-light: #{{ palette.red.hex }}; +$red-light: #{{ palette.red.hex }};
+$red-dark: #{{ palette.red.hex }}; +$red-dark: #{{ palette.red | mod(lightness=30) | get(key="hex") }};
+ +
+// Pink +// Pink
+$pink-light: #{{ palette.pink.hex }}; +$pink-light: #{{ palette.pink.hex }};
+$pink-dark: #{{ palette.pink.hex }}; +$pink-dark: #{{ palette.pink | mod(lightness=30) | get(key="hex") }};
+ +
+// Purple +// Purple
+$purple-light: #{{ palette.mauve.hex }}; +$purple-light: #{{ palette.mauve.hex }};
+$purple-dark: #{{ palette.mauve.hex }}; +$purple-dark: #{{ palette.mauve | mod(lightness=30) | get(key="hex") }};
+ +
+// Blue +// Blue
+$blue-light: #{{ palette.blue.hex }}; +$blue-light: #{{ palette.blue.hex }};
+$blue-dark: #{{ palette.blue.hex }}; +$blue-dark: #{{ palette.blue | mod(lightness=30) | get(key="hex") }};
+ +
+// Teal +// Teal
+$teal-light: #{{ palette.teal.hex }}; +$teal-light: #{{ palette.teal.hex }};
+$teal-dark: #{{ palette.teal.hex }}; +$teal-dark: #{{ palette.teal | mod(lightness=30) | get(key="hex") }};
+ +
+// Green +// Green
+$green-light: #{{ palette.green.hex }}; +$green-light: #{{ palette.green.hex }};
+$green-dark: #{{ palette.green.hex }}; +$green-dark: #{{ palette.green | mod(lightness=30) | get(key="hex") }};
+ +
+// Yellow +// Yellow
+$yellow-light: #{{ palette.yellow.hex }}; +$yellow-light: #{{ palette.yellow.hex }};
+$yellow-dark: #{{ palette.yellow.hex }}; +$yellow-dark: #{{ palette.yellow | mod(lightness=30) | get(key="hex") }};
+ +
+// Orange +// Orange
+$orange-light: #{{ palette.peach.hex }}; +$orange-light: #{{ palette.peach.hex }};
+$orange-dark: #{{ palette.peach.hex }}; +$orange-dark: #{{ palette.peach | mod(lightness=30) | get(key="hex") }};
+ +
+// Grey +// Grey
{% if flavor.dark -%} {#- https://github.com/catppuccin/gtk/blob/0c3e8817da94769887c690b2211e006b287b27b1/scripts/recolor.py#L153-L176 -#} +$grey-050: #{{ palette.text.hex }};
+$grey-050: #{{ palette.overlay2.hex }}; +$grey-100: #{{ palette.subtext1.hex }};
+$grey-100: #{{ palette.overlay1.hex }}; +$grey-150: #{{ palette.subtext1.hex }};
+$grey-150: #{{ palette.overlay0.hex }}; +$grey-200: #{{ palette.subtext0.hex }};
+$grey-200: #{{ palette.surface2.hex }}; +$grey-250: #{{ palette.subtext0.hex }};
+$grey-250: #{{ palette.surface1.hex }}; +$grey-300: #{{ palette.overlay1.hex }};
+$grey-300: red; +$grey-350: #{{ palette.overlay1.hex }};
+$grey-350: red; +$grey-400: #{{ palette.overlay0.hex }};
+$grey-400: red; +$grey-450: #{{ palette.overlay0.hex }};
+$grey-450: red; +$grey-500: #{{ palette.surface2.hex }};
+$grey-500: red; +$grey-550: #{{ palette.surface2.hex }};
+$grey-550: red; +$grey-600: #{{ palette.surface1.hex }};
+$grey-600: red; +$grey-650: #{{ palette.surface1.hex }};
+$grey-650: #{{ palette.surface0.hex }}; +$grey-700: #{{ palette.surface0.hex }};
+$grey-700: #{{ palette.base.hex }}; +$grey-750: #{{ palette.surface0.hex }};
+$grey-750: #{{ palette.crust.hex }}; +$grey-800: #{{ palette.base.hex }};
+$grey-800: #{{ palette.crust.hex }}; +$grey-850: #{{ palette.base.hex }};
+$grey-850: #020202; +$grey-900: #{{ palette.crust.hex }};
+$grey-900: #010101; +$grey-950: #{{ palette.crust.hex }};
+$grey-950: #000000;
{%- else -%} {#- Light mode https://github.com/catppuccin/gtk/blob/0c3e8817da94769887c690b2211e006b287b27b1/scripts/recolor.py#L128-L151 -#}
+$grey-050: #{{ palette.crust.hex }};
+$grey-100: #{{ palette.mantle.hex }};
+$grey-150: #{{ palette.base.hex }};
+$grey-200: #{{ palette.surface0.hex }};
+$grey-250: #{{ palette.surface1.hex }};
+$grey-300: red;
+$grey-350: red;
+$grey-400: red;
+$grey-450: red;
+$grey-500: red;
+$grey-550: red;
+$grey-600: red;
+$grey-650: #{{ palette.base.hex }};
+$grey-700: #{{ palette.base.hex }};
+$grey-750: #{{ palette.mantle.hex }};
+$grey-800: #{{ palette.text.hex }};
+$grey-850: #020202;
+$grey-900: #010101;
+$grey-950: #000000;
{%- endif %}
+ +
+// White +// White
+$white: #eff1f5; +$white: #FFFFFF;
+ +
+// Black +// Black
+$black: #11111b; +$black: #000000;
+ +
+// Button +// Button
+$button-close: #{{ palette.red.hex }}; +$button-close: #{{ palette.red.hex }};
@@ -121,3 +84,4 @@ index 00000000..4ff0da0d
+// Theme +// Theme
+$default-light: $purple-light; +$default-light: $purple-light;
+$default-dark: $purple-dark; +$default-dark: $purple-dark;
{{ '' }}

View File

@@ -0,0 +1,47 @@
diff --git a/src/sass/_colors.scss b/src/sass/_colors.scss
index e8366fa0..97fa670c 100644
--- a/src/sass/_colors.scss
+++ b/src/sass/_colors.scss
@@ -57,9 +57,8 @@
@else { @return rgba($white, 0.1); }
}
-@function theme($color) {
+@function theme() {
@if ($variant == 'light') {
- @if ($theme == 'default') { @return $default-dark; }
@if ($theme == 'purple') { @return $purple-dark; }
@if ($theme == 'pink') { @return $pink-dark; }
@if ($theme == 'red') { @return $red-dark; }
@@ -68,8 +67,9 @@
@if ($theme == 'green') { @return $green-dark; }
@if ($theme == 'teal') { @return $teal-dark; }
@if ($theme == 'grey') { @return $grey-600; }
+
+ @return $default-dark;
} @else {
- @if ($theme == 'default') { @return $default-light; }
@if ($theme == 'purple') { @return $purple-light; }
@if ($theme == 'pink') { @return $pink-light; }
@if ($theme == 'red') { @return $red-light; }
@@ -78,6 +78,8 @@
@if ($theme == 'green') { @return $green-light; }
@if ($theme == 'teal') { @return $teal-light; }
@if ($theme == 'grey') { @return $grey-200; }
+
+ @return $default-light;
}
}
@@ -113,9 +115,9 @@
// Basic colors
//
-$primary: theme(color);
+$primary: theme();
$drop_target_color: $orange-dark;
-$indicator: theme(color);
+$indicator: theme();
$titlebar-indicator: if($variant == 'dark', currentColor, $primary);
$inverse-indicator: if($theme == 'grey', $white, $primary);
$applet-primary: if($theme == 'grey' and variant == 'light' and $topbar == 'dark', $grey-200, $primary);

View File

@@ -1,84 +1,69 @@
diff --git a/src/sass/_color-palette-catppuccin-frappe.scss b/src/sass/_color-palette-catppuccin-frappe.scss diff --git a/src/sass/_color-palette-catppuccin-frappe.scss b/src/sass/_color-palette-catppuccin-frappe.scss
new file mode 100644 new file mode 100644
index 00000000..4ff0da0d index 00000000..8a905942
--- /dev/null --- /dev/null
+++ b/src/sass/_color-palette-catppuccin-frappe.scss +++ b/src/sass/_color-palette-catppuccin-frappe.scss
@@ -0,0 +1,87 @@ @@ -0,0 +1,72 @@
+ // Our accents
+ $rosewater: #f2d5cf;
+ $flamingo: #eebebe;
+ $pink: #f4b8e4;
+ $mauve: #ca9ee6;
+ $red: #e78284;
+ $maroon: #ea999c;
+ $peach: #ef9f76;
+ $yellow: #e5c890;
+ $green: #a6d189;
+ $teal: #81c8be;
+ $sky: #99d1db;
+ $sapphire: #85c1dc;
+ $blue: #8caaee;
+ $lavender: #babbf1;
+// Default Theme Color Palette +// Default Theme Color Palette
+ +
+// Red +// Red
+$red-light: #e78284; +$red-light: #e78284;
+$red-dark: #e78284; +$red-dark: #81191b;
+ +
+// Pink +// Pink
+$pink-light: #f4b8e4; +$pink-light: #f4b8e4;
+$pink-dark: #f4b8e4; +$pink-dark: #851567;
+ +
+// Purple +// Purple
+$purple-light: #ca9ee6; +$purple-light: #ca9ee6;
+$purple-dark: #ca9ee6; +$purple-dark: #58207a;
+ +
+// Blue +// Blue
+$blue-light: #8caaee; +$blue-light: #8caaee;
+$blue-dark: #8caaee; +$blue-dark: #143686;
+ +
+// Teal +// Teal
+$teal-light: #81c8be; +$teal-light: #81c8be;
+$teal-dark: #81c8be; +$teal-dark: #2f6b63;
+ +
+// Green +// Green
+$green-light: #a6d189; +$green-light: #a6d189;
+$green-dark: #a6d189; +$green-dark: #466f2b;
+ +
+// Yellow +// Yellow
+$yellow-light: #e5c890; +$yellow-light: #e5c890;
+$yellow-dark: #e5c890; +$yellow-dark: #7d5d1d;
+ +
+// Orange +// Orange
+$orange-light: #ef9f76; +$orange-light: #ef9f76;
+$orange-dark: #ef9f76; +$orange-dark: #8a3910;
+ +
+// Grey +// Grey
+$grey-050: #949cbb; +$grey-050: #c6d0f5;
+$grey-100: #838ba7; +$grey-100: #b5bfe2;
+$grey-150: #737994; +$grey-150: #b5bfe2;
+$grey-200: #626880; +$grey-200: #a5adce;
+$grey-250: #51576d; +$grey-250: #a5adce;
+$grey-300: red; +$grey-300: #838ba7;
+$grey-350: red; +$grey-350: #838ba7;
+$grey-400: red; +$grey-400: #737994;
+$grey-450: red; +$grey-450: #737994;
+$grey-500: red; +$grey-500: #626880;
+$grey-550: red; +$grey-550: #626880;
+$grey-600: red; +$grey-600: #51576d;
+$grey-650: #414559; +$grey-650: #51576d;
+$grey-700: #303446; +$grey-700: #414559;
+$grey-750: #232634; +$grey-750: #414559;
+$grey-800: #232634; +$grey-800: #303446;
+$grey-850: #020202; +$grey-850: #303446;
+$grey-900: #010101; +$grey-900: #232634;
+$grey-950: #000000; +$grey-950: #232634;
+ +
+// White +// White
+$white: #eff1f5; +$white: #FFFFFF;
+ +
+// Black +// Black
+$black: #11111b; +$black: #000000;
+ +
+// Button +// Button
+$button-close: #e78284; +$button-close: #e78284;

View File

@@ -1,84 +1,69 @@
diff --git a/src/sass/_color-palette-catppuccin-latte.scss b/src/sass/_color-palette-catppuccin-latte.scss diff --git a/src/sass/_color-palette-catppuccin-latte.scss b/src/sass/_color-palette-catppuccin-latte.scss
new file mode 100644 new file mode 100644
index 00000000..4ff0da0d index 00000000..8a905942
--- /dev/null --- /dev/null
+++ b/src/sass/_color-palette-catppuccin-latte.scss +++ b/src/sass/_color-palette-catppuccin-latte.scss
@@ -0,0 +1,87 @@ @@ -0,0 +1,72 @@
+ // Our accents
+ $rosewater: #dc8a78;
+ $flamingo: #dd7878;
+ $pink: #ea76cb;
+ $mauve: #8839ef;
+ $red: #d20f39;
+ $maroon: #e64553;
+ $peach: #fe640b;
+ $yellow: #df8e1d;
+ $green: #40a02b;
+ $teal: #179299;
+ $sky: #04a5e5;
+ $sapphire: #209fb5;
+ $blue: #1e66f5;
+ $lavender: #7287fd;
+// Default Theme Color Palette +// Default Theme Color Palette
+ +
+// Red +// Red
+$red-light: #d20f39; +$red-light: #d20f39;
+$red-dark: #d20f39; +$red-dark: #900a27;
+ +
+// Pink +// Pink
+$pink-light: #ea76cb; +$pink-light: #ea76cb;
+$pink-dark: #ea76cb; +$pink-dark: #851567;
+ +
+// Purple +// Purple
+$purple-light: #8839ef; +$purple-light: #8839ef;
+$purple-dark: #8839ef; +$purple-dark: #440b8f;
+ +
+// Blue +// Blue
+$blue-light: #1e66f5; +$blue-light: #1e66f5;
+$blue-dark: #1e66f5; +$blue-dark: #073693;
+ +
+// Teal +// Teal
+$teal-light: #179299; +$teal-light: #179299;
+$teal-dark: #179299; +$teal-dark: #148086;
+ +
+// Green +// Green
+$green-light: #40a02b; +$green-light: #40a02b;
+$green-dark: #40a02b; +$green-dark: #317921;
+ +
+// Yellow +// Yellow
+$yellow-light: #df8e1d; +$yellow-light: #df8e1d;
+$yellow-dark: #df8e1d; +$yellow-dark: #885712;
+ +
+// Orange +// Orange
+$orange-light: #fe640b; +$orange-light: #fe640b;
+$orange-dark: #fe640b; +$orange-dark: #993901;
+ +
+// Grey +// Grey
+$grey-050: #dce0e8; +$grey-050: #4c4f69;
+$grey-100: #e6e9ef; +$grey-100: #5c5f77;
+$grey-150: #eff1f5; +$grey-150: #5c5f77;
+$grey-200: #ccd0da; +$grey-200: #6c6f85;
+$grey-250: #bcc0cc; +$grey-250: #6c6f85;
+$grey-300: red; +$grey-300: #8c8fa1;
+$grey-350: red; +$grey-350: #8c8fa1;
+$grey-400: red; +$grey-400: #9ca0b0;
+$grey-450: red; +$grey-450: #9ca0b0;
+$grey-500: red; +$grey-500: #acb0be;
+$grey-550: red; +$grey-550: #acb0be;
+$grey-600: red; +$grey-600: #bcc0cc;
+$grey-650: #eff1f5; +$grey-650: #bcc0cc;
+$grey-700: #eff1f5; +$grey-700: #ccd0da;
+$grey-750: #e6e9ef; +$grey-750: #ccd0da;
+$grey-800: #4c4f69; +$grey-800: #eff1f5;
+$grey-850: #020202; +$grey-850: #eff1f5;
+$grey-900: #010101; +$grey-900: #dce0e8;
+$grey-950: #000000; +$grey-950: #dce0e8;
+ +
+// White +// White
+$white: #eff1f5; +$white: #FFFFFF;
+ +
+// Black +// Black
+$black: #11111b; +$black: #000000;
+ +
+// Button +// Button
+$button-close: #d20f39; +$button-close: #d20f39;

View File

@@ -1,84 +1,69 @@
diff --git a/src/sass/_color-palette-catppuccin-macchiato.scss b/src/sass/_color-palette-catppuccin-macchiato.scss diff --git a/src/sass/_color-palette-catppuccin-macchiato.scss b/src/sass/_color-palette-catppuccin-macchiato.scss
new file mode 100644 new file mode 100644
index 00000000..4ff0da0d index 00000000..8a905942
--- /dev/null --- /dev/null
+++ b/src/sass/_color-palette-catppuccin-macchiato.scss +++ b/src/sass/_color-palette-catppuccin-macchiato.scss
@@ -0,0 +1,87 @@ @@ -0,0 +1,72 @@
+ // Our accents
+ $rosewater: #f4dbd6;
+ $flamingo: #f0c6c6;
+ $pink: #f5bde6;
+ $mauve: #c6a0f6;
+ $red: #ed8796;
+ $maroon: #ee99a0;
+ $peach: #f5a97f;
+ $yellow: #eed49f;
+ $green: #a6da95;
+ $teal: #8bd5ca;
+ $sky: #91d7e3;
+ $sapphire: #7dc4e4;
+ $blue: #8aadf4;
+ $lavender: #b7bdf8;
+// Default Theme Color Palette +// Default Theme Color Palette
+ +
+// Red +// Red
+$red-light: #ed8796; +$red-light: #ed8796;
+$red-dark: #ed8796; +$red-dark: #861425;
+ +
+// Pink +// Pink
+$pink-light: #f5bde6; +$pink-light: #f5bde6;
+$pink-dark: #f5bde6; +$pink-dark: #861467;
+ +
+// Purple +// Purple
+$purple-light: #c6a0f6; +$purple-light: #c6a0f6;
+$purple-dark: #c6a0f6; +$purple-dark: #470d8d;
+ +
+// Blue +// Blue
+$blue-light: #8aadf4; +$blue-light: #8aadf4;
+$blue-dark: #8aadf4; +$blue-dark: #0d388d;
+ +
+// Teal +// Teal
+$teal-light: #8bd5ca; +$teal-light: #8bd5ca;
+$teal-dark: #8bd5ca; +$teal-dark: #297166;
+ +
+// Green +// Green
+$green-light: #a6da95; +$green-light: #a6da95;
+$green-dark: #a6da95; +$green-dark: #3a7228;
+ +
+// Yellow +// Yellow
+$yellow-light: #eed49f; +$yellow-light: #eed49f;
+$yellow-dark: #eed49f; +$yellow-dark: #835f17;
+ +
+// Orange +// Orange
+$orange-light: #f5a97f; +$orange-light: #f5a97f;
+$orange-dark: #f5a97f; +$orange-dark: #8f390b;
+ +
+// Grey +// Grey
+$grey-050: #939ab7; +$grey-050: #cad3f5;
+$grey-100: #8087a2; +$grey-100: #b8c0e0;
+$grey-150: #6e738d; +$grey-150: #b8c0e0;
+$grey-200: #5b6078; +$grey-200: #a5adcb;
+$grey-250: #494d64; +$grey-250: #a5adcb;
+$grey-300: red; +$grey-300: #8087a2;
+$grey-350: red; +$grey-350: #8087a2;
+$grey-400: red; +$grey-400: #6e738d;
+$grey-450: red; +$grey-450: #6e738d;
+$grey-500: red; +$grey-500: #5b6078;
+$grey-550: red; +$grey-550: #5b6078;
+$grey-600: red; +$grey-600: #494d64;
+$grey-650: #363a4f; +$grey-650: #494d64;
+$grey-700: #24273a; +$grey-700: #363a4f;
+$grey-750: #181926; +$grey-750: #363a4f;
+$grey-800: #181926; +$grey-800: #24273a;
+$grey-850: #020202; +$grey-850: #24273a;
+$grey-900: #010101; +$grey-900: #181926;
+$grey-950: #000000; +$grey-950: #181926;
+ +
+// White +// White
+$white: #eff1f5; +$white: #FFFFFF;
+ +
+// Black +// Black
+$black: #11111b; +$black: #000000;
+ +
+// Button +// Button
+$button-close: #ed8796; +$button-close: #ed8796;

View File

@@ -1,84 +1,69 @@
diff --git a/src/sass/_color-palette-catppuccin-mocha.scss b/src/sass/_color-palette-catppuccin-mocha.scss diff --git a/src/sass/_color-palette-catppuccin-mocha.scss b/src/sass/_color-palette-catppuccin-mocha.scss
new file mode 100644 new file mode 100644
index 00000000..4ff0da0d index 00000000..8a905942
--- /dev/null --- /dev/null
+++ b/src/sass/_color-palette-catppuccin-mocha.scss +++ b/src/sass/_color-palette-catppuccin-mocha.scss
@@ -0,0 +1,87 @@ @@ -0,0 +1,72 @@
+ // Our accents
+ $rosewater: #f5e0dc;
+ $flamingo: #f2cdcd;
+ $pink: #f5c2e7;
+ $mauve: #cba6f7;
+ $red: #f38ba8;
+ $maroon: #eba0ac;
+ $peach: #fab387;
+ $yellow: #f9e2af;
+ $green: #a6e3a1;
+ $teal: #94e2d5;
+ $sky: #89dceb;
+ $sapphire: #74c7ec;
+ $blue: #89b4fa;
+ $lavender: #b4befe;
+// Default Theme Color Palette +// Default Theme Color Palette
+ +
+// Red +// Red
+$red-light: #f38ba8; +$red-light: #f38ba8;
+$red-dark: #f38ba8; +$red-dark: #8c0e32;
+ +
+// Pink +// Pink
+$pink-light: #f5c2e7; +$pink-light: #f5c2e7;
+$pink-dark: #f5c2e7; +$pink-dark: #841667;
+ +
+// Purple +// Purple
+$purple-light: #cba6f7; +$purple-light: #cba6f7;
+$purple-dark: #cba6f7; +$purple-dark: #470d8d;
+ +
+// Blue +// Blue
+$blue-light: #89b4fa; +$blue-light: #89b4fa;
+$blue-dark: #89b4fa; +$blue-dark: #063d94;
+ +
+// Teal +// Teal
+$teal-light: #94e2d5; +$teal-light: #94e2d5;
+$teal-dark: #94e2d5; +$teal-dark: #21796a;
+ +
+// Green +// Green
+$green-light: #a6e3a1; +$green-light: #a6e3a1;
+$green-dark: #a6e3a1; +$green-dark: #2a7723;
+ +
+// Yellow +// Yellow
+$yellow-light: #f9e2af; +$yellow-light: #f9e2af;
+$yellow-dark: #f9e2af; +$yellow-dark: #8f650b;
+ +
+// Orange +// Orange
+$orange-light: #fab387; +$orange-light: #fab387;
+$orange-dark: #fab387; +$orange-dark: #943c06;
+ +
+// Grey +// Grey
+$grey-050: #9399b2; +$grey-050: #cdd6f4;
+$grey-100: #7f849c; +$grey-100: #bac2de;
+$grey-150: #6c7086; +$grey-150: #bac2de;
+$grey-200: #585b70; +$grey-200: #a6adc8;
+$grey-250: #45475a; +$grey-250: #a6adc8;
+$grey-300: red; +$grey-300: #7f849c;
+$grey-350: red; +$grey-350: #7f849c;
+$grey-400: red; +$grey-400: #6c7086;
+$grey-450: red; +$grey-450: #6c7086;
+$grey-500: red; +$grey-500: #585b70;
+$grey-550: red; +$grey-550: #585b70;
+$grey-600: red; +$grey-600: #45475a;
+$grey-650: #313244; +$grey-650: #45475a;
+$grey-700: #1e1e2e; +$grey-700: #313244;
+$grey-750: #11111b; +$grey-750: #313244;
+$grey-800: #11111b; +$grey-800: #1e1e2e;
+$grey-850: #020202; +$grey-850: #1e1e2e;
+$grey-900: #010101; +$grey-900: #11111b;
+$grey-950: #000000; +$grey-950: #11111b;
+ +
+// White +// White
+$white: #eff1f5; +$white: #FFFFFF;
+ +
+// Black +// Black
+$black: #11111b; +$black: #000000;
+ +
+// Button +// Button
+$button-close: #f38ba8; +$button-close: #f38ba8;

View File

@@ -1,46 +0,0 @@
diff --git a/src/sass/_colors.scss b/src/sass/_colors.scss
index 8738bf37..71797c6d 100644
--- a/src/sass/_colors.scss
+++ b/src/sass/_colors.scss
@@ -58,27 +58,20 @@
}
@function theme($color) {
- @if ($variant == 'light') {
- @if ($theme == 'default') { @return $default-dark; }
- @if ($theme == 'purple') { @return $purple-dark; }
- @if ($theme == 'pink') { @return $pink-dark; }
- @if ($theme == 'red') { @return $red-dark; }
- @if ($theme == 'orange') { @return $orange-dark; }
- @if ($theme == 'yellow') { @return $yellow-dark; }
- @if ($theme == 'green') { @return $green-dark; }
- @if ($theme == 'teal') { @return $teal-dark; }
- @if ($theme == 'grey') { @return $grey-600; }
- } @else {
- @if ($theme == 'default') { @return $default-light; }
- @if ($theme == 'purple') { @return $purple-light; }
- @if ($theme == 'pink') { @return $pink-light; }
- @if ($theme == 'red') { @return $red-light; }
- @if ($theme == 'orange') { @return $orange-light; }
- @if ($theme == 'yellow') { @return $yellow-light; }
- @if ($theme == 'green') { @return $green-light; }
- @if ($theme == 'teal') { @return $teal-light; }
- @if ($theme == 'grey') { @return $grey-200; }
- }
+ @if ($theme == 'rosewater') { @return $rosewater; }
+ @if ($theme == 'flamingo') { @return $flamingo; }
+ @if ($theme == 'pink') { @return $pink; }
+ @if ($theme == 'mauve') { @return $mauve; }
+ @if ($theme == 'red') { @return $red; }
+ @if ($theme == 'maroon') { @return $maroon; }
+ @if ($theme == 'peach') { @return $peach; }
+ @if ($theme == 'yellow') { @return $yellow; }
+ @if ($theme == 'green') { @return $green; }
+ @if ($theme == 'teal') { @return $teal; }
+ @if ($theme == 'sky') { @return $sky; }
+ @if ($theme == 'sapphire') { @return $sapphire; }
+ @if ($theme == 'blue') { @return $blue; }
+ @if ($theme == 'lavender') { @return $lavender; }
}
@function background($type) {

View File

@@ -1,2 +0,0 @@
generated/
patched/

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 60 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 49 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 60 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 49 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 60 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 49 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 60 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 49 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 60 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 49 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 60 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 49 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 60 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 49 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 60 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 49 KiB

View File

@@ -1,244 +0,0 @@
from typing import List
from catppuccin import PALETTE
from catppuccin.models import Flavor
import re, os, shutil, subprocess, time
from dataclasses import dataclass
THIS_DIR = os.path.dirname(os.path.realpath(__file__))
INDEX = [
"close-active",
"close-inactive",
"close-prelight",
"close-pressed",
"hide-active",
"hide-inactive",
"hide-prelight",
"hide-pressed",
"maximize-active",
"maximize-inactive",
"maximize-prelight",
"maximize-pressed",
"maximize-toggled-active",
"maximize-toggled-inactive",
"maximize-toggled-prelight",
"maximize-toggled-pressed",
"menu-active",
"menu-inactive",
"menu-prelight",
"menu-pressed",
"shade-active",
"shade-inactive",
"shade-prelight",
"shade-pressed",
"shade-toggled-active",
"shade-toggled-inactive",
"shade-toggled-prelight",
"shade-toggled-pressed",
"stick-active",
"stick-inactive",
"stick-prelight",
"stick-pressed",
"stick-toggled-active",
"stick-toggled-inactive",
"stick-toggled-prelight",
"stick-toggled-pressed",
"title-1-active",
"title-1-inactive",
"title-2-active",
"title-2-inactive",
"title-3-active",
"title-3-inactive",
"title-4-active",
"title-4-inactive",
"title-5-active",
"title-5-inactive",
"top-left-active",
"top-left-inactive",
"top-right-active",
"top-right-inactive",
"left-active",
"left-inactive",
"right-active",
"right-inactive",
"bottom-active",
"bottom-inactive",
"bottom-left-active",
"bottom-left-inactive",
"bottom-right-active",
"bottom-right-inactive",
]
def subst_text(path, _from, to):
with open(path, "r+") as f:
content = f.read()
f.seek(0)
f.truncate()
f.write(re.sub(_from, to, content))
def generate_for_flavor(flavor: Flavor):
# Setup the palette
palette = flavor.colors
close_color=f'#{palette.red.hex}'
max_color=f'#{palette.green.hex}'
min_color=f'#{palette.yellow.hex}'
# We expand the source assets into the 4 flavors, but need to map between
# Their definition of dark and ours. This means that latte will get the -light assets
# and the rest get the -dark assets to work from
color = "-dark"
if not flavor.dark:
color = "-light"
# Make a directory for our patched SVGs to live in before compilation
odir = f"{THIS_DIR}/patched"
os.makedirs(odir, exist_ok=True)
# Copy the base assets into the output
shutil.copy(
f"{THIS_DIR}/assets{color}.svg",
f"{odir}/assets-catppuccin-{flavor.identifier}.svg",
)
shutil.copy(
f"{THIS_DIR}/assets{color}-normal.svg",
f"{odir}/assets-catppuccin-{flavor.identifier}-normal.svg",
)
# Patch all the SVGs
path = f"{odir}/assets-catppuccin-{flavor.identifier}-normal.svg"
subst_text(path, "#fd5f51", close_color)
subst_text(path, "#38c76a", max_color)
subst_text(path, "#fdbe04", min_color)
headerbar = palette.base.hex
headerbar_backdrop = palette.mantle.hex
if flavor.dark:
path = f"{odir}/assets-catppuccin-{flavor.identifier}.svg"
subst_text(path, "#242424", headerbar)
subst_text(path, "#2c2c2c", headerbar_backdrop)
path = f"{odir}/assets-catppuccin-{flavor.identifier}-normal.svg"
subst_text(path, "#242424", headerbar)
subst_text(path, "#2c2c2c", headerbar_backdrop)
else:
path = f"{odir}/assets-catppuccin-{flavor.identifier}.svg"
subst_text(path, "#f2f2f2", headerbar)
subst_text(path, "#fafafa", headerbar_backdrop)
path = f"{odir}/assets-catppuccin-{flavor.identifier}-normal.svg"
subst_text(path, "#f2f2f2", headerbar)
subst_text(path, "#fafafa", headerbar_backdrop)
@dataclass
class WorkerInput:
output_path: str
output_dir: str
input_path: str
dpi: str
ident: str
def call_subprocesses(inp: WorkerInput):
inkscape = "inkscape"
optipng = "optipng"
return [
subprocess.Popen(
[
inkscape,
"--export-id",
inp.ident,
"--export-id-only",
"--export-dpi",
inp.dpi,
"--export-filename",
inp.output_path,
inp.input_path,
],
stdout=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
),
subprocess.Popen(
[optipng, "-o7", "--quiet", inp.output_path],
stdout=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
),
]
@dataclass
class RenderState:
tasks: List[subprocess.Popen]
input_root: str
output_root: str
screen_to_dpi = {
"-hdpi": "144",
"-xhdpi": "192",
}
def render_for_screen(state: RenderState, flavor: Flavor, screen: str, ident: str):
# NOTE: We do not generate for the -normal variant currently, that would just be
# a stupid amount of compute and time for little benefit
src_file = f"{state.input_root}/assets-catppuccin-{flavor.identifier}.svg"
output_dir = f"{state.output_root}/assets-catppuccin-{flavor.identifier}{screen}"
output_path = f"{output_dir}/{ident}.png"
dpi = screen_to_dpi.get(screen, "96")
os.makedirs(output_dir, exist_ok=True)
if os.path.exists(output_path):
print(f"Skipping '{output_path}', already generated")
else:
new_tasks = call_subprocesses(
WorkerInput(
output_path=output_path,
output_dir=output_dir,
input_path=src_file,
dpi=dpi,
ident=ident,
)
)
state.tasks.extend(new_tasks)
def render_for_flavor(flavor: Flavor, state: RenderState):
print(
f"Starting render tasks for {flavor.identifier}"
)
for ident in INDEX:
render_for_screen(state=state, flavor=flavor, screen="", ident=ident)
render_for_screen(state=state, flavor=flavor, screen="-hdpi", ident=ident)
render_for_screen(state=state, flavor=flavor, screen="-xhdpi", ident=ident)
generate_for_flavor(PALETTE.mocha)
generate_for_flavor(PALETTE.latte)
generate_for_flavor(PALETTE.macchiato)
generate_for_flavor(PALETTE.frappe)
state = RenderState(
tasks=[], input_root=f"{THIS_DIR}/patched", output_root=f"{THIS_DIR}/generated"
)
start_time = time.time()
render_for_flavor(PALETTE.mocha, state)
render_for_flavor(PALETTE.latte, state)
render_for_flavor(PALETTE.macchiato, state)
render_for_flavor(PALETTE.frappe, state)
for task in state.tasks:
task.wait()
end_time = time.time() - start_time
print(f"Generation complete in {end_time} seconds")
shutil.rmtree(state.input_root)

View File

@@ -1,9 +0,0 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
],
"git-submodules": {
"enabled": true
}
}

View File

@@ -1,13 +1,11 @@
{ { pkgs ? import <nixpkgs> { } }:
pkgs ? import <nixpkgs> { },
}:
pkgs.mkShell { pkgs.mkShell {
name = "dev-shell"; name = "dev-shell";
buildInputs = with pkgs; [ buildInputs = with pkgs; [
python311 python311
python311Packages.catppuccin python311Packages.catppuccin
sassc sassc
inkscape
optipng
]; ];
} }