• Stars
    star
    435
  • Rank 99,233 (Top 2 %)
  • Language
    Rust
  • License
    MIT License
  • Created about 4 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🎨💧 An easy to use base16 scheme manager that integrates with any workflow.

flavours logo


A manager/builder for Base16. Written in Rust🦀.

Crates.io Build hydra status

Packaging status

Looking for something similar to use with NixOS/home-manager? Check out nix-colors

What

This is a CLI program that both builds and manages Base16 schemes and templates.

The Base16 specification consists of both schemes (with 16 colors) and templates. There'll probably be templates for most applications you use, but you can easily make one for literally any app that supports any sort of color customization.

Once your configuration files are set, you can theme your entire desktop with just one command. No more hassle manually changing themes when you get bored. Why have one color if you can have all the colors?

Here's how it looks in action (sway, waybar, alacritty): Usage

How

Installation

Packages

  • AUR Package for Arch (and derivatives): yay -S flavours
  • nixpkg for NixOS: nix-env -iA nixos.flavours
  • Homebrew for macOS: brew install flavours

Let me know if you want to package flavours for your favorite distro.

Cargo

Just install cargo and run cargo install --locked flavours (don't forget to include ~/.cargo/bin in your PATH).

Post-install

After installing, you should probably use flavours update all to grab all published schemes and templates from the Base16 repos. By default, these files are located in ~/.local/share/flavours on Linux, and ~/Library/Application Support/flavours on macOS. This can be changed with the -d/--directory flag or FLAVOURS_DATA_DIRECTORY environment variable.

If you want to make changes to schemes/templates or make your own, see Custom templates and schemes.

Usage

You can use flavours and Base16 templates to automatically inject schemes into any application config file that supports color codes.

Dave Snider did a great 3 episode series about flavours (and theming in general). If you're into guide videos, I strongly recommend you take a look.

Setup

Choose a template for each app you want themed (or create your own).

Add your apps to the flavours configuration, located at ~/.config/flavours/config.toml on Linux and macOS. This can be changed with -c/--config flag or FLAVOURS_CONFIG_FILE environment variable.

For the flavours configuration file, config.toml:

  • Optionally, set a shell through which your hook commands should be executed. Defaults to sh -c '{}'.
  • Create an [[items]] section for each app. Each section can have the following entries:
    • The file to write (required).
    • A template (required).
    • A subtemplate. You can use the literal value {scheme} to select a subtemplate named the same way as a scheme, usefull if you have scheme dependent subtemplates. Defaults to default (also if a subtemplate named as the selected scheme isn't found).
    • A hook to execute. Defaults to none.
    • Specified as light, for lightweight changes that are quick to execute. Defaults to true. flavours apply --light will skip running hooks marked with light=false.
    • Whether to rewrite the entire file instead of replacing lines. Defaults to false, but it is recommended to set this to true for apps that can have an entire file defining colors through import or some other means.
    • If rewrite=false, specify the start and end lines for replacing text. This is useful for config files where comments do not begin with #. Defaults to # Start flavours and # End flavours (case-insensitive).

Here's an example:

# Commands go through bash
shell = "bash -c '{}'"

# Sway supports the default '#' comments, so it can be ommited
# 'rewrite' is also ommited, as it defaults to false
[[items]]
file = "~/.config/sway/config"
template = "sway"
subtemplate = "colors"
hook = "swaymsg reload"
# Swaymsg reload temporarily freezes input, so it's marked as not light
light = false

# This one uses waybar 'default' subtemplate, so it can be ommited
[[items]]
file = "~/.config/waybar/colors.css"
template = "waybar"
# Waybar uses a separate color file, so we can safely rewrite the whole file
rewrite = true

[[items]]
file = "~/.config/beautifuldiscord/style.css"
template = "styles"
subtemplate = "css-variables"
# What if the configuration doesn't support '#' comments? Just change them!
start= "/* Start flavours */"
end = "/* End flavours */"

For files where rewrite=false (or omitted), tell flavours where to replace lines by placing a start and end comment in the app's config file where colors are set. Default start and end comments are # Start flavours and # End flavours.

For reference, here's a couple configuration files from my dots:

Vóila. You're now ready to apply schemes.

Custom templates and schemes

To help manage your custom templates/schemes or your tweaks to pre-existing ones, flavours will also look in the user's $XDG_CONFIG_HOME/flavours directory, typically ~/.config/flavours, when looking for templates/schemes. The folder structure should be the same as at ~/.local/share/flavours/base16/.

Examples:

  • Custom scheme myscheme: $XDG_CONFIG_HOME/flavours/schemes/myscheme/myscheme.yaml
  • Custom template mysoftware/mytemplate: $XDG_CONFIG_HOME/flavours/templates/mysoftware/templates/mytemplate.mustache

Note, in case of conflict, schemes/templates in $XDG_CONFIG_HOME/flavours have priority over the ones in ${FLAVOURS_DATA_DIRECTORY:-~/.local/share/flavours}.

Applying

flavours apply is the command you'll probably be using all the time, so it's built to be as useful as possible.

The syntax is flavours apply [PATTERN], where PATTERN can be a scheme name, multiple scheme name, a glob (such as *light) expression, or can be ommited. If more than one scheme is specified or matched, flavours will choose one randomly For example, flavours apply *light will pick one random scheme ending with "light", and apply it.

You can, for instance:

  • Specify a scheme: flavours apply pasque
  • Specify multiple schemes: flavours apply pasque paraiso atlas
  • Use globs: flavours apply "gruvbox*"
  • Omit the pattern: flavours apply (is the same as running flavours apply "*")

Other commands

Other commands include:

  • flavours current to see the last scheme you applied
  • flavours list [PATTERN] to list all available schemes
  • flavours info [PATTERN] to show info (including truecolor colored output) about some scheme(s)
  • flavours build <path_to_scheme> <path_to_template> (see Build below)
  • flavours generate <dark|light> path/to/image/file (see Generate below)

Build

You can also use flavours as a simple Base16 builder. You can easily get a scheme path by using flavours info theme_name | head -1 | cut -d '@' -f2). This works great for automating static styles, and anything else you can come up with (I use it on my personal website).

Generate

Lastly, we have flavours generate, which can generate a scheme based on an image such as a wallpaper. By default, the scheme will be saved with the slug generated, but you can change it with -s or --slug or output to stdout instead with --stdout.

Why

Why use this instead of other Base16 managers, or even pywal?

While these projects are great and certainly fit some people's workflow, they didn't quite fit mine.

I decided to do my own project because I wanted a simple CLI program that can easily integrate with rofi, polybar, and everything else in my workflow. The main feature is being able to quickly and easily use a curated list of schemes, on all your apps. It's also objectively faster than any other manager.

When

All features are implemented! I'm currently working on improving code quality and stabilizing the features, but everything should work as intended.

Thanks to:

More Repositories

1

nix-starter-configs

Simple and documented config templates to help you get started with NixOS + home-manager + flakes. All the boilerplate you need!
Nix
1,677
star
2

nix-config

Personal nixos and home-manager configurations.
Nix
585
star
3

nix-colors

Modules and schemes to make theming with Nix awesome.
Nix
402
star
4

dotfiles

Dotfiles for my Arch setup.
Mustache
16
star
5

paste.misterio.me

Simple pasting service
Rust
12
star
6

disconic

Discord bot for interacting with subsonic music libraries
Rust
9
star
7

website

My personal website and blog
Liquid
6
star
8

base16-nebula-scheme

Blue and Green Base16 Scheme
6
star
9

minicava

A miniature cava sound visualizer, designed for running in status bars
Shell
5
star
10

aoc2022

My Haskell and Rust attempt on AoC 2022
Rust
5
star
11

base16-pasque-scheme

Purple and Gold Base16 Theme
4
star
12

Modpack

Meu modpackzinho
TOML
4
star
13

my-minecraft-server

My minecraft server, which is ran using docker compose
Shell
3
star
14

nixos-hyprland-example

Nix
3
star
15

BSI-SCC0560

Parte final do trabalho de IHC
HTML
3
star
16

nur-packages

My personal NUR repo
Nix
3
star
17

pokedex-pfpa

Projeto da disciplina de Programação Funcional Pura com Aplicações (2022)
Haskell
3
star
18

base16-spotify

Base16 for spotify (using spicetify)
HTML
2
star
19

yrmos

Protótipo para a disciplina de empreendedorismo
Rust
2
star
20

BSI

Repositório arquivado, agora são vários repositórios em um projeto no SourceHut: https://hub.sr.ht/~misterio/BSI
TeX
2
star
21

sep0566

Listas e notas de introdução a economia
TeX
2
star
22

minecraftd

Minecraft server daemon script, forked from Edenhofer. Now supports multiple servers at once.
Shell
2
star
23

base16-sakura-scheme

Light pink scheme for base16
2
star
24

shellcolord

Shell
2
star
25

base16-catppuccin-scheme

Catppuccin base16 theme
2
star
26

rgbdaemon

Simple script for interfacing with OpenRGB and CKB-next programmatically
Shell
2
star
27

drupal-12factor

drupal-12factor
PHP
2
star
28

base16-silk-scheme

Cyan/blueish theme for base16, with light and dark options
2
star
29

BMA-SME0230

Jogo da cobrinha muito bolado
C
2
star
30

base16-spaceduck-scheme

Spaceduck scheme, packaged for use with base16
1
star
31

pass-wofi

A wofi graphical menu for pass
Shell
1
star
32

BSI-SSC0510

Disciplina de Arquitetura de Computadores
1
star
33

IHC2021

Implementação de IHC
Rust
1
star
34

typst-nix

A simple function to build typst projects using nix
Nix
1
star
35

modpack-da-informacao

Modpack para o BSI, ICMC & amigos
1
star
36

RubensCrew

Trabalhos e projetos BSI 2020
C
1
star
37

T1-ICC2

Trabalho 1 da disciplina ICC 2
TeX
1
star
38

bsi-modpack

Modpack files
Shell
1
star
39

misterio77

Hey!
1
star
40

Trabalho-IDW

Projeto da disciplina Introdução ao Desenvolvimento Web
JavaScript
1
star
41

T2-ED2

C
1
star
42

sistemer-bot

Bot do BSI 020 para telegram
Rust
1
star
43

bungeecord-aur

Bungeecord AUR package and management script, forked from Edenhofer. Supports multiple servers.
Shell
1
star
44

SCC0541-Lab-BD-Projeto

Projeto da disciplina de Laboratório de Bases de Dados (SCC0541) - 2022/1
SCSS
1
star
45

pmis

CLI companion for paste.misterio.me
Rust
1
star
46

base16-uwunicorn-scheme

Pretty scheme
1
star
47

BSI-SCC0505-T1

Trabalho 1 de Introdução a Teoria Computacional
Rust
1
star
48

ModpackConfig

Just config files for my Modpack :D
1
star
49

aws-azure-login-action

GitHub action for aws-azure-login
TypeScript
1
star
50

T2-ED

Trabalho 2 de Estrutura de Dados
C
1
star