Misterio77 / flavours

🎨💧 An easy to use base16 scheme manager that integrates with any workflow.
MIT License
501 stars 29 forks source link

Use base16_color_scheme for building the base16-themes #76

Closed titaniumtraveler closed 1 year ago

titaniumtraveler commented 1 year ago

I'm using flavours more or less since I switched to arch 2.5 years ago and I'm really loving it.

Though when at the current implementation of I found a few things that could be improved, a few edge cases that could be caught. \ One example would be that {{ base00-rgb-r }} doesn't get expanded and that things like

{{!
  Template adapted from here:
  https://github.com/chriskempson/base16-builder/blob/master/templates/gnome-terminal/dark.sh.erb
}}

don't get removed as they should. \ (This specific example seems to be a common mustache-pattern to write comments.)

To help to improve that I wrote a small crate I called base16_color_scheme. (Because I'm terrible with names.)

It uses ramhorns as mustache engine and is focused on maintainability, performance and correctness. \ I tested its results against flavours current implementations for all available templates using cat ~/.local/share/flavours/base16/templates/*/templates/*.mustache > all_templates.mustache and the results are mostly the same except for cases like those described above, while being 10 to 12 times faster on --release. \ (Though that doesn't really translates to smaller files, because in those cases alone the act of reading and writing the files takes much longer than the building step and also has much more variance.)

Due to the way I build the library it was it was trivial to implement support for up to 256 colors (base00 to baseff, which is exactly what a u8 holds.) and the Hls color-space. (Fixing #49 and #73, though looking at it base24 already was supported.)

This is actually one of the first library-crates I have written and the first I have published to crates.io so I'm open to constructive criticism.

One thing I definitely still have to improve in my crate is documentation. The current API should be fairly self explanatory, but having a description of what the different parts do and examples on how to use them is something I really want to add.

Misterio77 commented 1 year ago

This looks awesome! I'll be sure to take a deeper look at it ASAP. Thanks a lot :)

titaniumtraveler commented 1 year ago

I now have finally added the API documentation.