Giter VIP home page Giter VIP logo

flavours's Introduction

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:

flavours's People

Contributors

awanwar avatar denizdogan avatar dependabot[bot] avatar dtolnay avatar k4j8 avatar loiccoyle avatar misterio77 avatar probably-neb avatar softsun2 avatar titaniumtraveler avatar vrmiguel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

flavours's Issues

Error pulling from github

Hello,

I installed flavours from the AUR and couldn't make it work on my new laptop. It used to work on my previous one but didn't try recently (will try to when I find it again).

I have lots of lines in the likes of fatal: impossible d'accéder à 'https://github.com/afq984/base16-xfce4-terminal/' : Could not resolve host: github.com when updating templates and schemes.

What I don't quite understand is that I can go to github without issues on my browser and also curl github.com without errors.

I selfhost AdGuard Home and thought it might have interfered but I didn't find anything wrong in the logs (github.com requests are answered and not blocked). I tried disabling AdGuard's protection just in case but it changed nothing. I'll try with a different wifi just in case.

I have no idea how to troubleshoot this more,
Thanks :)

Configure alacritty with more specific colors ?

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

colors:
  primary:
    background: '0x282828'
    foreground: '0xdfbf8e'

  normal:
    black:   '0x665c54'
    red:     '0xea6962'
    green:   '0xa9b665'
    yellow:  '0xe78a4e'
    blue:    '0x7daea3'
    magenta: '0xd3869b'
    cyan:    '0x89b482'
    white:   '0xdfbf8e'

  bright:
    black:   '0x928374'
    red:     '0xea6962'
    green:   '0xa9b665'
    yellow:  '0xe3a84e'
    blue:    '0x7daea3'
    magenta: '0xd3869b'
    cyan:    '0x89b482'
    white:   '0xdfbf8e'

against to this

colors:
  # Default colors
  primary:
    background: '0x{{base00-hex}}'
    foreground: '0x{{base05-hex}}'

  # Colors the cursor will use if `custom_cursor_colors` is true
  cursor:
    text: '0x{{base00-hex}}'
    cursor: '0x{{base05-hex}}'

  # Normal colors
  normal:
    black:   '0x{{base00-hex}}'
    red:     '0x{{base08-hex}}'
    green:   '0x{{base0B-hex}}'
    yellow:  '0x{{base0A-hex}}'
    blue:    '0x{{base0D-hex}}'
    magenta: '0x{{base0E-hex}}'
    cyan:    '0x{{base0C-hex}}'
    white:   '0x{{base05-hex}}'

  # Bright colors
  bright:
    black:   '0x{{base03-hex}}'
    red:     '0x{{base09-hex}}'
    green:   '0x{{base01-hex}}'
    yellow:  '0x{{base02-hex}}'
    blue:    '0x{{base04-hex}}'
    magenta: '0x{{base06-hex}}'
    cyan:    '0x{{base0F-hex}}'
    white:   '0x{{base07-hex}}'

draw_bold_text_with_bright_colors: false

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)

changing colors for shell

Hi,
First of all flavours itself works like a charm and I could hardly be happier!
My only problem is changing the colors of my shell. The actual updating works fine but I can not figure out a proper hook to apply. sourcing the bashrc can not change my current session of course so i am a bit dumbfounded.

Code refactor (perhaps as a library?)

I'm a much better rust programmer by now. When i programmed most of flavours, i was still using very imperative approuches, which could now be replaced by more idiomatic code, OOP patterns, for example.

I've been thinking about reestructuring the project as a library, just wondering if this could be useful or consumed anywhere outside itself.

I'd love to hear feedback and advice, if anyone happens to have some

generated color scheme gives some weird colors

Hi again,

I've really been liking flavours so far, the main gripe I have is that depending on the image the color scheme generation algorithm can give (imo) some weird color choices. Here is an example: https://imgur.com/a/U8Aa0kR as you can see the image is quite dark and basically just shades of blue, while the generated colors are very bright neon colors with not much blue, and the background color is a relatively bright purple.

I can give more examples if needed. I suspect it has trouble finding colors when an image is made up of similar shades of a color ?

I understand that colors are very much subject to personal preference, so if you disagree and deem this to be expected behaviour then please feel free to close this issue.

Create caches of generated colorschemes for faster switching

Right now flavours recreates the colour schemes from files afresh every time the generate command is called.

If we could store the generated colour scheme in a folder (perhaps in the same folder as other colour schemes or in $HOME/.cache/) and then when that same file is used to generate a colour scheme, using the pre-generated one instead of generating a new one would cut some of the workload and thus resulting time I guess.

Better Documentation

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.

Use yaml serde on update module

Currently update works by simply reading the yaml and cutting where we find a ':'. I ended up using yaml serde on apply module, so it would be nice to implement this.

Provide a default config for each template.

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.

Compatible with vim?

I see there is a vim template but I cannot get it to work. I also see that you are not using flavours to change your colorscheme in your dotfiles for vim/nvim. Why not?
Although the picture in the README is bad quality, it seems like there is vim in there?

I'd really love some good documentation with a few recipes to get inspiration, I might submit a PR to improve that part. If I can get it to work, that is 😆

Support for RGBA / RGB output for transparency

Right now the application outputs the color codes in hex, but some apps (e.g zathura) don't allow transparency unless specified in RGBA format.
Something like {{base05-rgb}} or {{base05-rgba}} just as we have {{base05-hex}}.

As mentioned here, we can use {{base05-rgb-r}} {{base05-rgb-g}} {{base05-rgb-b}} to get the r g and b values instead.

Read scheme from stdin instead of file

I've been getting into NixOS (and immutable stuff in general). Given the fact that flavours generate can output a scheme to stdout, would be nice if flavours apply could read a scheme from stdin.

Error: Couldn't get items from config file.

Hey there!
First off, thank you for developing this, it looks incredibly promising! 👍
I just can't seem to get it to work, whenever I run flavours apply <theme-name> (nord for example) I just get the following error message:

Error: Couldn't get items from config file. Check the default file or github for config examples.

This is my configuration:

# 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/kitty/colors.conf"
subtemplate = "default"
template = "kitty"

And I ran flavours update all several times now.

Have a good day!

Improve apply performance

Performance seems to be great right now (the program runs in about 10ms if no hooks are ran).

But there's a place where we could improve, specifically when the template variables are replaced.
Right now we do multiple passes on the template (one for each variable).

I'm not so sure on how to make multiple passes in a idiomatic-ish way, but will take a look.

[Enhancement] Run hooks inside a shell

It would be nice to allow users to run the hook inside their chosen shell. Through a configuration? Maybe trying to autodetect as well.

That would allow both shell expansion and syntax on hooks

qutebrowser hook issue

I was trying out flavours but I have run into a problem.

I want to reload qutebrowser here is the relevant part of the config:

[[item]]
file='$XDG_CONFIG_HOME/qutebrowser/colours.py'
template='qutebrowser'
subtemplate='minimal'
rewrite=true
hook='pgrep -x qutebrowser && qutebrowser :config-source'

But unfortunately qutebrowser does not reload. If I run the hook command in a terminal it works fine. if I remove the pgrep part and use:

hook='qutebrowser :config-source'

it also works but causes issues (not related to flavours) when qutebrowser is not running.

Note that flavours does not print out an error message.

Error when starting new terminal instance

After cargo install flavours, every time I start a new terminal instance:

/path/to/bin/flavours:1: no matches found: ^@^@^@^@^@^@^@__nl_symbol_ptr^@__DATA^@^@^@^@^@^@^@^@^@^@^@^P%^@^A^@^@^@^P^@^@^@^@^@^@^@^@^P%^@^C^@^@^@^@^@^@^@^@^@^@^@^F^@^@^@^?^@^@^@^@^@^@^@^@^@^@^@__got^@^@^@^@^@^@^@^@^@^@^@__DATA^@^@^@^@^@^@^@^@^@^@^P^P%^@^A^@^@^@^H^@^@^@^@^@^@^@^P^P%^@^C^@^@^@^@^@^@^@^@^@^@^@^F^@^@^@\M-^A^@^@^@^@^@^@^@^@^@^@^@__la_symbol_ptr^@__DATA^@^@^@^@^@^@^@^@^@^@^X^P%^@^A^@^@^@\M-x^C^@^@^@^@^@^@^X^P%^@^C^@^@^@^@^@^@^@^@^@^@^@^G^@^@^@\M-^B^@^@^@^@^@^@^@^@^@^@^@__const^@^@^@^@^@^@^@^@^@__DATA^@^@^@^@^@^@^@^@^@^@^P^T%^@^A^@^@^@\M-^H?^A^@^@^@^@^@^P^T%^@^C^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@__data^@^@^@^@^@^@^@^@^@^@__DATA^@^@^@^@^@^@^@^@^@^@\M-^XS
/path/to/bin/flavours:1: permission denied: 
/path/to/bin/flavours:1: permission denied: 
/path/to/bin/flavours:1: permission denied: 
/path/to/bin/flavours:1: permission denied: 
/path/to/bin/flavours:1: permission denied: 
/path/to/bin/flavours:1: permission denied: 
/path/to/bin/flavours:1: permission denied: 
[3] 61515
/path/to/bin/flavours:1: parse error near `&'
/path/to/bin/flavours:1: parse error in command substitution
/path/to/bin/flavours:1: command not found: \M-O\M-z\M-m\M-~^G
[3]  - exit 127        

Note that everything seems to work correctly apart from that.
I am really not in a position to help with the fixing on my own but I'm happy to try things if I can help.

Create a new `pub fn` wrapper to expose `fn build_template` via the cli

Proposed interface:

    .subcommand(
        App::new("build")
            .about("Builds template with given scheme, outputs to stdout")
            .setting(AppSettings::UnifiedHelpMessage)
            .setting(AppSettings::DeriveDisplayOrder)
            .setting(AppSettings::DisableHelpSubcommand)
            .setting(AppSettings::DisableVersion)
            .setting(AppSettings::ColoredHelp)
            .arg(
                Arg::new("scheme")
                .about("Path to scheme file.")
                .long("scheme")
                .short('s')
                .required(true)
                .value_hint(ValueHint::FilePath)
            )
            .arg(
                Arg::new("template")
                .about("Path to template file.")
                .long("template")
                .short('t')
                .required(true)
                .value_hint(ValueHint::FilePath)
            )
    )

I got the feeling that I could implement this, even though I've never done Rust, by looking at:

Would you be open to this if I submitted a PR?

Better config parsing error text

When I write incorrect syntax in my config.toml, I get the following error message:

$ flavours apply $theme
Error: Couldn't parse configuration file. Check if it's syntatically correct

Caused by:
    expected an equals, found a colon at line 7 column 8

I think it would be helpful to include the path to the config file. I wasn't sure if this was referring to the flavours config or my other config files :)

Build failed: could not compile flavours` due to 21 previous errors

Hi,

Trying to install flavours by running cargo install flavours but I get the following output:

   Compiling flavours v0.5.1
error[E0599]: no variant or associated item named `UnifiedHelpMessage` found for enum `AppSettings` in the current scope
 --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:9:31
  |
9 |         .setting(AppSettings::UnifiedHelpMessage)
  |                               ^^^^^^^^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `ColoredHelp` found for enum `AppSettings` in the current scope
  --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:13:31
   |
13 |         .setting(AppSettings::ColoredHelp)
   |                               ^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `UnifiedHelpMessage` found for enum `AppSettings` in the current scope
  --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:49:39
   |
49 |                 .setting(AppSettings::UnifiedHelpMessage)
   |                                       ^^^^^^^^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `ColoredHelp` found for enum `AppSettings` in the current scope
  --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:53:39
   |
53 |                 .setting(AppSettings::ColoredHelp)
   |                                       ^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `UnifiedHelpMessage` found for enum `AppSettings` in the current scope
  --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:58:39
   |
58 |                 .setting(AppSettings::UnifiedHelpMessage)
   |                                       ^^^^^^^^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `ColoredHelp` found for enum `AppSettings` in the current scope
  --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:62:39
   |
62 |                 .setting(AppSettings::ColoredHelp)
   |                                       ^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `UnifiedHelpMessage` found for enum `AppSettings` in the current scope
  --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:80:39
   |
80 |                 .setting(AppSettings::UnifiedHelpMessage)
   |                                       ^^^^^^^^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `ColoredHelp` found for enum `AppSettings` in the current scope
  --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:84:39
   |
84 |                 .setting(AppSettings::ColoredHelp)
   |                                       ^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `UnifiedHelpMessage` found for enum `AppSettings` in the current scope
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:102:39
    |
102 |                 .setting(AppSettings::UnifiedHelpMessage)
    |                                       ^^^^^^^^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `ColoredHelp` found for enum `AppSettings` in the current scope
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:106:39
    |
106 |                 .setting(AppSettings::ColoredHelp)
    |                                       ^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `UnifiedHelpMessage` found for enum `AppSettings` in the current scope
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:156:39
    |
156 |                 .setting(AppSettings::UnifiedHelpMessage)
    |                                       ^^^^^^^^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `ColoredHelp` found for enum `AppSettings` in the current scope
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:160:39
    |
160 |                 .setting(AppSettings::ColoredHelp)
    |                                       ^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `UnifiedHelpMessage` found for enum `AppSettings` in the current scope
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:183:39
    |
183 |                 .setting(AppSettings::UnifiedHelpMessage)
    |                                       ^^^^^^^^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `ColoredHelp` found for enum `AppSettings` in the current scope
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:187:39
    |
187 |                 .setting(AppSettings::ColoredHelp)
    |                                       ^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `UnifiedHelpMessage` found for enum `AppSettings` in the current scope
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:198:39
    |
198 |                 .setting(AppSettings::UnifiedHelpMessage)
    |                                       ^^^^^^^^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `ColoredHelp` found for enum `AppSettings` in the current scope
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/cli.rs:202:39
    |
202 |                 .setting(AppSettings::ColoredHelp)
    |                                       ^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0061]: this function takes 4 arguments but 3 arguments were supplied
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/completions.rs:12:25
    |
12  |         Some("bash") => generate::<Bash, _>(&mut build_cli(), "flavours", &mut io::stdout()),
    |                         ^^^^^^^^^^^^^^^^^^^ ----------------  ----------  ----------------- supplied 3 arguments
    |                         |
    |                         expected 4 arguments
    |
note: function defined here
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_generate-3.0.0-beta.5/src/lib.rs:239:8
    |
239 | pub fn generate<G, S>(gen: G, app: &mut clap::App, bin_name: S, buf: &mut dyn Write)
    |        ^^^^^^^^

error[E0061]: this function takes 4 arguments but 3 arguments were supplied
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/completions.rs:13:27
    |
13  |         Some("elvish") => generate::<Elvish, _>(&mut build_cli(), "flavours", &mut io::stdout()),
    |                           ^^^^^^^^^^^^^^^^^^^^^ ----------------  ----------  ----------------- supplied 3 arguments
    |                           |
    |                           expected 4 arguments
    |
note: function defined here
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_generate-3.0.0-beta.5/src/lib.rs:239:8
    |
239 | pub fn generate<G, S>(gen: G, app: &mut clap::App, bin_name: S, buf: &mut dyn Write)
    |        ^^^^^^^^

error[E0061]: this function takes 4 arguments but 3 arguments were supplied
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/completions.rs:15:13
    |
15  |             generate::<PowerShell, _>(&mut build_cli(), "flavours", &mut io::stdout())
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^ ----------------  ----------  ----------------- supplied 3 arguments
    |             |
    |             expected 4 arguments
    |
note: function defined here
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_generate-3.0.0-beta.5/src/lib.rs:239:8
    |
239 | pub fn generate<G, S>(gen: G, app: &mut clap::App, bin_name: S, buf: &mut dyn Write)
    |        ^^^^^^^^

error[E0061]: this function takes 4 arguments but 3 arguments were supplied
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/completions.rs:19:13
    |
19  |             generate::<Fish, _>(&mut build_cli(), "flavours", &mut buffer);
    |             ^^^^^^^^^^^^^^^^^^^ ----------------  ----------  ----------- supplied 3 arguments
    |             |
    |             expected 4 arguments
    |
note: function defined here
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_generate-3.0.0-beta.5/src/lib.rs:239:8
    |
239 | pub fn generate<G, S>(gen: G, app: &mut clap::App, bin_name: S, buf: &mut dyn Write)
    |        ^^^^^^^^

error[E0061]: this function takes 4 arguments but 3 arguments were supplied
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.1/src/completions.rs:33:13
    |
33  |             generate::<Zsh, _>(&mut build_cli(), "flavours", &mut buffer);
    |             ^^^^^^^^^^^^^^^^^^ ----------------  ----------  ----------- supplied 3 arguments
    |             |
    |             expected 4 arguments
    |
note: function defined here
   --> /home/jsoares/.cargo/registry/src/github.com-1ecc6299db9ec823/clap_generate-3.0.0-beta.5/src/lib.rs:239:8
    |
239 | pub fn generate<G, S>(gen: G, app: &mut clap::App, bin_name: S, buf: &mut dyn Write)
    |        ^^^^^^^^

Some errors have detailed explanations: E0061, E0599.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `flavours` due to 21 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `flavours v0.5.1`, intermediate artifacts can be found at `/tmp/cargo-installoG5gXA`

Caused by:
  build failed

I've also tried installing version 0.4.0 but the same thing occurs, the output is slightly different (has 26 errors instead of 21).

Kind Regards,
jsoares

Escaping quotes and double-quotes

I have a vimscript file that I would like to insert a color scheme to. Using the start and end parameters, I am experiencing difficulties as the character for comments in vimscript is ". Attempting to do such gives me this error:

Couldn't replace lines in "/home/siri/.config/nvim/colors.vim": Couldn't find starting string.

Escaping with / (i.e /") as in Rust or \ (i.e \") as in TOML gives me the same exact error. Using single quotes and not escaping ('") as in TOML does not work either.

For now, my solution is to use rewrite=true and store the color scheme in a separate file. However it would be more optimal for my use case if I can group airline and vim themes in the same file.

Broken pipe (os error 32) when piping output to head

thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:895:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

shows up sometimes whenever I pipe the output of flavours info $(flavours current) using head like this

flavours info $(flavours current) | head -n<integer>

The command works fine and the error can be avoided by redirecting it to /dev/null but thought I'd let you know just in case.

also running with env variable RUST_BACKTRACE=1 doesn't provide a backtrace

Update is slow

Currently process:command is being used for cloning repos, and, being syncronous, is very slow.
Maybe is there a way to make them async?

Config file not in the designated place on MacOS

As mentioned, I'm on MacOS.

Expected:
what is shown in the help message when flavours is run on its own, that is:

  • The config file is by default ~/.config/flavours/config.toml,
  • The data file is by default ~/.local/share/flavours,

Got:

  • Both files are put in ~/Library/Application Support/flavours/

That wouldn't be a problem except for the fact that the help message is misleading and I cannot figure out how to change the config and data files to their rightful place.

Really liking the project apart from that, thanks!

info fails to parse non-existent scheme

Hi,

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

Error: Couldn't parse scheme toast. Check if it's syntatically correct.

Caused by:
    missing field `scheme` at line 1 column 6

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.

apply schemes for specific items

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'.

[Feature] Add priority on hooks

Some hooks work better when ran before or after others. Maybe you want to sync stuff changing colors, and a few commands take too long to complete. I'll try to add an optional priority setting. I brainstormed it being an integer, with 0 being default, higher numbers running before lower ones.

Set minimum Rust Version

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.

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 😛.

Automate completion fixing

At the moment we're using clap-generate to generate completion scripts.
The only issue is completing apply and info with available schemes. As they are dynamic, i wasn't able to make clap's possible_values take that list.
Currently, i've been able to make it work by manually changing the completion file after generation, but maybe there's a way to fix it inside the code, or maybe with a github action?

Modify sources

Hey,

I really like using this tool as it simplifies my theme changing habit a lot. However one thing I think which could be better would be to be able specify the templates and schemes sources directly in the config.toml file.

I think it would be easier especially when initializing the tool to have them in the configuration file as it is configure IMHO instead of having to manually create all the folder arborescence in .local/...

I could try submitting a PR for this if you're interested although I've never writtenrrust before

Cheers

Select subtemplate based on scheme

Hi,

Summary

Sometimes, for whatever reason, you might want to use a different subtemplate for some program based on the scheme that you're using.

Use case

Example:

I have a custom template for sway which I like for most schemes. However, for some schemes I would like a different template (otherwise it looks bad or is hardly readable). I could change my custom template when I'm using these schemes, or I could write a new custom template and reference it in my config file, however those are "a lot" of manual steps that I don't want to do every time I change scheme, which is more or less often.

Solution

If a subtemplate named exactly like the scheme being used is found for a certain component (e.g base16/templates/sway/templates/darkmoss.mustache), use it instead of the one given in the config.

Discussion

This would be my preferred behaviour and it shouldn't interfere with other workflows, however, I understand it might have some undesired effects on some edge cases. It could also be optionally activated to mitigate this.

Would you be interested in such a functionality? I have a MR ready if so. If you have some feedback I could try to implement it. I'm a rust noob but am learning ;)

No autocomplete for query

I couldn't find a way to autocomplete query command with available schemes (that means it will not be possible to autocomplete apply command as well) while keeping the glob matching functionality.

Building themes requires path to scheme and template

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 😄.

Not sure where to put custom template

I'm just testing for now but I'm loving it up until now.
Got a small problem though : I'm not sure where I should put my custom templates. I need one for .Xresources since using # Start flavours didn't work in it, but I originally created it in ~/.local/share/flavours/base16/templates/xresources/templates by copying the default one. It worked (i could select it using subtemplate = myfilename in my config.toml, but after a flavours update all, it disappeared.
Did I misplace the file ? Or is it unwanted behavior that it god deleted with an update ?
If I did misplace it, where would you recomand putting it ? I'd try some things myself, but I'd rather have confirmation before doing all my configurations if there's a risk the files might get deleted later.
Thanks for all the work

Can't install via cargo

Since I don't have Arch or Nix I wanted to install simply using cargo install flavours. However it runs into compilation errors (see output below). Specifying a version didn't work either (e.g. cargo install flavours --version 0.5.0, etc.). I pinned down the problem to the clap and clap_generate packages but couldn't solve it anyway. It downloads and compiles the version 3.0.0-beta.4 although you specify 3.0.0-beta.2 in the Cargo.toml. I am just a Rust beginner, so it might be an easy to correct error,

I looked into the pkgbuild for Arch and was able to install it using those commands in Ubuntu.

Here's the output of cargo install (trimmed for visibility):

   Compiling flavours v0.5.0
error[E0599]: no variant or associated item named `GlobalVersion` found for enum `AppSettings` in the current scope
 --> /home/<user>/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.0/src/cli.rs:8:31
  |
8 |         .setting(AppSettings::GlobalVersion)
  |                               ^^^^^^^^^^^^^ variant or associated item not found in `AppSettings`

error[E0599]: no variant or associated item named `DisableVersion` found for enum `AppSettings` in the current scope
  --> /home/<user>/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.0/src/cli.rs:52:39
   |
52 |                 .setting(AppSettings::DisableVersion)
   |                                       ^^^^^^^^^^^^^^
   |                                       |
   |                                       variant or associated item not found in `AppSettings`
   |                                       help: there is a variant with a similar name: `DisableVersionFlag`

error[E0599]: no variant or associated item named `DisableVersion` found for enum `AppSettings` in the current scope
  --> /home/<user>/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.0/src/cli.rs:61:39
   |
61 |                 .setting(AppSettings::DisableVersion)
   |                                       ^^^^^^^^^^^^^^
   |                                       |
   |                                       variant or associated item not found in `AppSettings`
   |                                       help: there is a variant with a similar name: `DisableVersionFlag`

error[E0599]: no method named `multiple` found for struct `Arg` in the current scope
  --> /home/<user>/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.0/src/cli.rs:68:22
   |
68 |                     .multiple(true)
   |                      ^^^^^^^^ method not found in `Arg<'_>`

error[E0599]: no variant or associated item named `DisableVersion` found for enum `AppSettings` in the current scope
  --> /home/<user>/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.0/src/cli.rs:83:39
   |
83 |                 .setting(AppSettings::DisableVersion)
   |                                       ^^^^^^^^^^^^^^
   |                                       |
   |                                       variant or associated item not found in `AppSettings`
   |                                       help: there is a variant with a similar name: `DisableVersionFlag`

error[E0599]: no method named `multiple` found for struct `Arg` in the current scope
  --> /home/<user>/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.0/src/cli.rs:90:22
   |
90 |                     .multiple(true)
   |                      ^^^^^^^^ method not found in `Arg<'_>`

error[E0599]: no variant or associated item named `DisableVersion` found for enum `AppSettings` in the current scope
   --> /home/<user>/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.0/src/cli.rs:105:39
    |
105 |                 .setting(AppSettings::DisableVersion)
    |                                       ^^^^^^^^^^^^^^
    |                                       |
    |                                       variant or associated item not found in `AppSettings`
    |                                       help: there is a variant with a similar name: `DisableVersionFlag`

error[E0599]: no variant or associated item named `DisableVersion` found for enum `AppSettings` in the current scope
   --> /home/<user>/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.0/src/cli.rs:159:39
    |
159 |                 .setting(AppSettings::DisableVersion)
    |                                       ^^^^^^^^^^^^^^
    |                                       |
    |                                       variant or associated item not found in `AppSettings`
    |                                       help: there is a variant with a similar name: `DisableVersionFlag`

error[E0599]: no method named `multiple` found for struct `Arg` in the current scope
   --> /home/<user>/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.0/src/cli.rs:166:22
    |
166 |                     .multiple(true)
    |                      ^^^^^^^^ method not found in `Arg<'_>`

error[E0599]: no variant or associated item named `DisableVersion` found for enum `AppSettings` in the current scope
   --> /home/<user>/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.0/src/cli.rs:186:39
    |
186 |                 .setting(AppSettings::DisableVersion)
    |                                       ^^^^^^^^^^^^^^
    |                                       |
    |                                       variant or associated item not found in `AppSettings`
    |                                       help: there is a variant with a similar name: `DisableVersionFlag`

error[E0599]: no variant or associated item named `DisableVersion` found for enum `AppSettings` in the current scope
   --> /home/<user>/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/flavours-0.5.0/src/cli.rs:201:39
    |
201 |                 .setting(AppSettings::DisableVersion)
    |                                       ^^^^^^^^^^^^^^
    |                                       |
    |                                       variant or associated item not found in `AppSettings`
    |                                       help: there is a variant with a similar name: `DisableVersionFlag`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `flavours` due to 11 previous errors

Just wanted to give a heads-up. Thanks for your effort developing this package!
Cheers.

Add configuration to execute processed templates

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.

Publish package on Homebrew

Hi,

I love flavours, thanks so much!
Would it be possible to have it available from Homebrew?

Let me know if I can be of any help.

Error updating after installation

Hello.
I was trying to test flavours but encountered this error just after installation. I installed flavours from the aur and ran flavours update all as suggested by the readme. On running this, flavours returns this:

 ~  flavours update all
fatal: could not read Username for 'https://github.com': terminal prompts disabled
fatal: could not read Username for 'https://github.com': terminal prompts disabled
fatal: cannot change to '/home/rider/.config/flavours/base16/sources/schemes': No such file or directory
Error: Git failed to run on repository 'https://github.com/chriskempson/base16-schemes-source.git'. Check if your repo list is valid.

I only changed the environment variable FLAVOURS_DATA_DIRECTORY to ~/.config/flavours. I made no change regarding flavours config file.

The repo, upon checking does not exist. I can use git just fine on my terminal and browser so i have no idea what bought this on.

Thanks for the awesome tool :)

Trouble getting zsh completion to work

By reading the source code, I found the undocumented feature of flavours —completions zsh. But eval-ing it doesn’t work, and redirecting it to a file and sourcing it doesn’t work.

❯ flavours --completions zsh > /tmp/flavours.completions.zsh


❯ eval "$(flavours --completions zsh)"
_arguments:comparguments:325: can only be called from completion function


❯ source /tmp/flavours.completions.zsh
_arguments:comparguments:325: can only be called from completion function

Any help would be appreciated. (I have used bash since 1995 and just switched to zsh a few months ago, so I'm out of my element here.)

Encapsulate apply command functionality

A lot of the apply work is done in the apply function right now. I should probably split it up so it can be reused later (for instance, getting the scheme for a "info" subcommand).

AUR package cannot find templates in config path

Hello, I've been playing around with flavours for a couple hours now and It's pretty great. I've been having trouble getting it to recognize my custom schemes and templates in my .config/flavours directory. I cloned it to my machine and was playing around with it looking for a bug and ... couldn't find one? The cloned version works just fine. Both the outputs are shown below

using /usr/bin/flavours installed through aur:

❱ flavours apply nord
Error: Couldn't read template i3/nebi3 at "/home/neb/.local/share/flavours/base16/templates/i3/templates/nebi3.mustache". Check if the correct template/subtemplate was specified, and run the update templates command if you didn't already.

Caused by:
    No such file or directory (os error 2)

using local build & cargo run:

❱ cargo run -- apply nord
    Finished dev [unoptimized + debuginfo] target(s) in 0.21s
     Running `target/debug/flavours apply nord`
Some("/home/neb/.config/flavours/templates/i3/templates/nebi3.mustache"), Is_file: true
Some("/home/neb/.config/flavours/templates/nvim/templates/default.mustache"), Is_file: false
Some("/home/neb/.config/flavours/templates/kitty/templates/default.mustache"), Is_file: false

the extra "is_file" lines were my attempts at debugging it's the only change I've made to the code

I double checked if it was recognizing my config file as shown:

❱  flavours -v
Using directory: "/home/neb/.local/share/flavours"
Using config file: "/home/neb/.config/flavours/config.toml"

I'm at a loss for why these two builds would be different, and why only the AUR build would be unable to recognize the templates and schemes directories in my .config. Hoping you might have some insights
thanks!

Option to list all available templates, not only schemes

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.