A manager/builder for Base16

Notice: This README refers to the latest (possibly unreleased) master version


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

Notice: This README refers to the latest (possibly unreleased) master version. Some docs might differ from the version you're using. Maybe you're looking for the 0.5.0 version?

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):

How

Installation

Packages

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

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

Cargo

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

Post-install

After installing, you should probably use flavours update all to grab all published schemes and templates from the base16 repos. If you want, you can manually tweak the templates, schemes or even the repo lists (everything's located in ~/.local/share/flavours on Linux, and can be changed with -d/--directory cli option or FLAVOURS_DATA_DIRECTORY environment variable).

Usage

You can use flavours and base16 templates to automatically inject schemes into any application config file that supports colors 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).

On each of your apps config files, place a start and end comment to tell flavours where to replace lines (defaults are # Start flavours and # End flavours, can be changed individually on each app). These usually should be located where you set color options on your app configuration. If the specific app supports including colors from another file, or if the template provides the entire file, you can forgo the comments altogether and use the rewrite=true on flavours config.

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

  • flavours itself
  • alacritty
  • qutebrowser
  • zathura
  • sway
  • waybar
  • rofi

On flavours configuration (~/.config/flavours/config.toml on Linux, can be changed with -c/--config flag or FLAVOURS_CONFIG_FILE environment variable):

  • Optionally, set a shell through which your hook commands should be executed. Defaults to sh -c '{}'. You can make the hooks run directly (pre-0.4 behaviour) by setting it to just {}.
  • Create a [[items]] section for each app, each section can have the following entries:
    • Specify the file to write (required)
    • A template (required)
    • A hook to execute. Defaults to none.
    • A subtemplate. Defaults to default.
    • Specify whether the hook is considered (by your usage) to be light or not. flavours apply --light will skip running hooks marked with light=false. Defaults to true.
    • Whether to use rewrite mode (if you do, you don't need the start and end comments). Defaults to false.
    • Or change the start and end lines (useful for config files which comments are not started 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 */"

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

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 (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 glob: flavours apply "gruvbox*"
  • Omit: flavours apply (is the same as running flavours apply "*")

Other commands

You can also use flavours current to see the last scheme you applied, flavours list to list all available schemes (you can also use PATTERN like on apply to list only specific scheme(s)), flavours info to show info (including truecolor colored output) about some scheme(s) (also supports the PATTERN syntax).

You can also use flavours as a simple base16 builder. Just use the build command: flavours build <path_to_scheme> <path_to_template> (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).

Lastly, we have flavours generate, it can generate a scheme based on an image (usually your wallpaper), with the following syntax: flavours generate <dark/light> /path/to/image/file. By default, the scheme will be saved with the slug (the scheme name referenced in all other commands) generated (you can change it with -s or --slug, or output to stdout instead with --stdout).

In my setup, i use swaybg to apply wallpapers, and i can get my current wallpaper with cat .bg.

So my flavours command to generate and apply a dark scheme matching my wallpaper would be:

flavours generate dark $(cat .bg) && flavours apply generated

Which i include in the script i use to change my wallpapers randomly.

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:

  • Functionality inspiration from Base16 Universal Manager.
  • Logo inspiration from Starship prompt
Issues

Collection of the latest Issues

Spuxy

Spuxy

2

Hey! i love ur library but im worried how can i configure colors for alacritty like this

against to this

for example i have different color for background and for black color but in this template it uses same color. So im limited because of this ? base16 provides only 16 colors but theoretically i can use for alacritty 18-20 different colors (include colors for cursor)

pcgjerde

pcgjerde

bug
2

Hi,

I recently started getting an error when trying to run flavours info. After listing a few schemes it gives the following error:

This seems especially odd to me since as far as I can tell there is no theme named 'toast' in Base16, and the next theme alphabetically should be "classic". have tried deleting ~/.local/share/flavours and running flavours update all, but I still get the same error.

I am still able to use the other subcommands as expected.

heygsiri

heygsiri

enhancement
3

Hi,

I have been tinkering with flavours to make my color configs flexible. Updating, applying, and generating schemes have been a breeze so far. However, building seems to have an issue: I have to provide a path to the .mustache or .yaml files for the scheme and template, otherwise the build command won't work.

Kindly see the asciicast below for an example with scheme nord and template i3. Applying the themes goes seamlessly (although you won't see it due to limitations of asciicinema), but I struggle to build a scheme.

asciicast

I do not have Rust experience although I am more than happy to answer questions to help make this awesome software more awesome :smile:.

Quitlox

Quitlox

1

Hi there! First of all, great tool! I'm having a lot of fun with it.

While installing flavours on a different machine using cargo build (same using the AUR package), I encountered an error.

147501977-c23a8610-7072-41d8-bc2b-a77d12c35787.png

As it turns out, just upgrading my Rust version from 1.52 to 1.57 solved the issue.

It took me a second to figure out, since I am not experienced with Rust, and I imagine I am not the only one. Would it be an idea to set a minimum Rust version in cargo.toml? It seems that this is possible as of recent (rust-lang/cargo#9732).

Alternatively, I would propose to add one or two lines in the README.md stating upgrading as a potential fix for build errors. The latter I could do myself, the former is probably easier for someone with experience in Rust :stuck_out_tongue:.

lijiaqigreat

lijiaqigreat

1

I think most of the config will be the same for most users. It would be nice to provide a default config, and add an "enabled" flag defaulting to false.

Or even better, defaulting the "enabled" flag to "auto" which detects whether a program exists.

devhell

devhell

enhancement
1

Hi,

First of all, thank you so much for this wonderful tool. It's made my life a lot easier and its design is fantastic!

I'm not sure if I'm just not seeing it, but is there a way to easily list available templates? Listing schemes is not an issue of course, but when I want to check which apps are supported I find myself having to look in ~/.local/share/flavours/templates/. Is there a way of listing templates directly in flavours, and if not, would you consider it for future versions?

Thank you again!

risen

risen

question
2

Hi!

Some templates generate a script to be executed. Unless there's a way I don't know of, I'm supposed to use the hook = … entry to:

  • set the executable bit on the generated script
  • execute it
  • maybe clean up afterwards

Maybe there should be an easier way to do it: it could for instance create a tempfile(), execute it, and clean it up, making even the file = … entry optional.

dustinlagoy

dustinlagoy

enhancement
1

First, flavours is great, thanks! I like to have complementary schemes, as in solarized-light in my terminal and solarized-dark for things like i3. For now I can make this work by having different config files and running:

flavours -c ~/.config/flavours/config-light.toml apply solarized-light
flavours -c ~/.config/flavours/config-dark.toml apply solarized-dark

Would it be useful to implement a different way to handle this? Perhaps one could specify items to apply themes to in the apply command, either by name (which would probably be the value of the template variable) or maybe some tag in the configuration to apply to many items at once. Like:

flavours apply solarized-light --name alacritty
flavours apply solarized-light --tag light

Where the alacritty item would have a line like tag = 'light'.

Misterio77

Misterio77

documentation
10

I think flavours is pretty easy to use, but that's probably biased as i wrote it. Would love to hear docs suggestions, and am accepting help documenting as well.

Let me know how you use flavours and what features aren't very clear.

Versions

Find the latest versions by id

v0.5.2 - Oct 29, 2021

Hey!

This release explicitly locks clap version, as to avoid compiling issues reported #38 (caused by cargo install not respecting Cargo.lock).

v0.5.1 - Oct 09, 2021

Hey!

This small release contains a few fixes that have been waiting around to be release, and hopefully fixes #37.

This also includes support for base24 schemes and templates. This is fully backwards compatible, the 8 extra colors can be used by templates as desired (or not used at all), and all have fallback colors when you use a base16 scheme.

I've also renamed the configuration key item to items, this is also backwards compatible and basically just for better semantics.

v0.5.0 - Jun 28, 2021

Hey guys!

You can now use flavours as a traditional base16 builder: the subcommand flavours build builds a given template file using a scheme file. Perfect for any cool automation you can think of.

The flavours apply subcommand now supports a --stdin flag. This can be used in all sorts of ways, but the reasoning for this addition was chaining with flavours generate, allowing you to generate and apply a scheme without writing it to disk first (works great if you have an immutable flavours directory, for example): flavours generate --stdout dark kitties-wallpaper.png | flavours apply --stdin.

I've also revamped how shell completion generation works, no more manual fixing nescessary!

v0.4.0 - Apr 01, 2021

Hey everyone!

This release includes a new feature, that allows hooks to run inside a shell. This should allow you to use bash (or any other) syntax on your hooks.

The shell is configurable on your config.toml, but defaults to sh -c '{}'. This means it should work by default in any POSIX system. If you use flavours on windows (i'm not sure if someone does?), this will probably be a breaking change, so configure your shell to whatever you use (or set it to {} to get the pre-0.4 behaviour).

Let me know if you have any feedback!

v0.3.6 - Mar 02, 2021

Hey folks, a quick and small feature i noticed was interesting when trying out fzf as a scheme chooser.

You can now specify whether configuration items are lightweight or not. They default to light=true, that is, all items are light enough unless you explicitly tell flavours otherwise. When running apply, you can use flavours apply --light to only run lightweight hooks, that is, skip any hooks you marked as heavy-duty.

This enables you to do some pretty cool stuff, such as using fzf's --preview to seamlessly (really, flavours is insanely fast) preview schemes on the fly (while skipping hooks that take a second or so to run, such as sway's reload), and only run the non-lightweight hooks after you're done selecting.

How it looks: Usage

For anyone interested, this fuzzy selector can easily be done with: flavours list -l | fzf --preview='flavours apply -l {}'

If you want something more advanced (revert to previous scheme when fzf is closed with esc, run flavours apply on non-lightweight mode after selecting), it's quite simple too:

v0.3.5 - Feb 03, 2021

This release includes the fix from #22, which should fix #14.

v0.3.4 - Dec 06, 2020

Fixes:

  • #16: BrokenPipe panic when piping flavours info to something that closes the stream during execution (such as head or tail). That might still be broken for other subcommands, but they're not that useful for piping so will do that later.
  • Decrease minimum luma for dark backgrounds, as sometimes we have perfectly fine colors (which are saturated enough) which will be ignored (which in a few cases will cause a non dominant color to be picked, such as in this wallpaper)

v0.3.3 - Nov 19, 2020

Increased minimum luma and decrease maximum saturation of light schemes backgrounds. Increased minimum luma of dark schemes accent colors.

v0.3.2 - Nov 17, 2020

Breaking changes:

  • Printing colors with info command is now the default behaviour. Use -r or --raw to print just the codes.

Features:

  • Added the generate subcommand!
    • You can generate nice schemes based on an image, choosing whether you want a dark or light scheme
    • Example usage: flavours generate dark /path/to/nice/wallpaper.png && flavours apply generated
    • For best results, i recommend making a simple script to grap your current wallpaper path, and run that whenever you update your wallpaper

Internal changes:

  • Encapsulated both scheme and config
  • Changed module hierarchy, now the operations are a submodule

v0.2.2 - Oct 26, 2020

Got around testing flavours on fish, it seems it supports auto completing with a command output as list as well (like zsh does). Made that change on the completion file and it should work nicely now.

v0.2.1 - Oct 24, 2020

From 0.2:

Added info subcommand, which allows you to see any scheme info in a human-readable way. It shows name, author, colors (in hex), and even supports printing with the actual schemes colors (if your terminal supports truecolor, of course)

(Releasing minor version as i created the 0.2 tag without bumping first)

v0.2 - Oct 24, 2020

Added info subcommand, which allows you to see any scheme info in a human-readable way. It shows name, author, colors (in hex), and even supports printing with the actual schemes colors (if your terminal supports truecolor, of course)

v0.1.5 - Oct 13, 2020

This version should improve how we store the templates, sources and lists repositories. Instead of a full clone, we now just do a shallow one, checkout exactly what we need and delete the .git, thus avoiding wasting disk space with random files from those repositories (looking at you, vice scheme).

v0.1.4 - Sep 23, 2020

Update to latest clap version.

v0.1.3 - Sep 18, 2020

Just bumping the version to update the README on crates.io

v0.1.2 - Sep 18, 2020

A fex fixes and improvements:

  • Create default config if it doesn't exist. Better handling of non-existent directory.
  • Removed clap logic from module files
  • Downgraded clap version to crates.io version (non-git)
  • Added cargo.lock
  • Published on crates.io (and badges on readme <3)

v0.1 - Sep 18, 2020

Here's the first fully functional release for flavours.

It's almost 2am and i'm too tired to write documentation now. But basic usage requires you to prepare your configuration files (for example a wm, or a terminal) for base16 templates. You can configure ~/.config/flavours/config.toml to your liking, just add items with [[item]] and the required keys (check example.toml for examples).

Have fun!

Information - Updated May 13, 2022

Stars: 238
Forks: 17
Issues: 12

RGB (Rust Game Boy) is a simple emulator for the original game boy and the...

RGB (Rust Game Boy) is a simple emulator for the original game boy and the color game boy

RGB (Rust Game Boy) is a simple emulator for the original game boy and the...

A dead simple ANSI terminal color painting library for Rust

See the ansi_term, term_painter, to name a few), begging the question: why yet another? Here

A dead simple ANSI terminal color painting library for Rust

a tool to analyze file system usage written in Rust

coloured output, according to the LS_COLORS environment variable

a tool to analyze file system usage written in Rust

Rust VEML6040 RGBW Color Sensor Driver

This is a platform agnostic Rust driver for the VEML6040 RGBW color light

Rust VEML6040 RGBW Color Sensor Driver

A Gameboy Color (GBC) emulator written in Rust

There are two types of tests:

A Gameboy Color (GBC) emulator written in Rust

Convenience Rust code that handles coordinate transformations, Jones matrices,

The library dir can be specified manually with ERFA_LIB

Convenience Rust code that handles coordinate transformations, Jones matrices,

Argentum is a Game Boy Colour emulator written in Rust

You don't need to install SDL2 as it is bundled with

Argentum is a Game Boy Colour emulator written in Rust

Ad hoc HTML for Rust

This crate aims to provide a Rust API to easily create HTML div elements and manage their positions by pixel coordinates

Ad hoc HTML for Rust

This is a Rust library for geographic coordinate frame conversion

All the functions are implemented in f64 precision

This is a Rust library for geographic coordinate frame conversion
Facebook Instagram Twitter GitHub Dribbble
Privacy