Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use base16_color_scheme for building the base16-themes #76

Merged
merged 1 commit into from
Apr 30, 2023
Merged

Use base16_color_scheme for building the base16-themes #76

merged 1 commit into from
Apr 30, 2023

Conversation

titaniumtraveler
Copy link
Contributor

@titaniumtraveler titaniumtraveler commented Apr 4, 2023

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
Copy link
Owner

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

@Misterio77 Misterio77 self-requested a review April 6, 2023 16:54
@titaniumtraveler
Copy link
Contributor Author

titaniumtraveler commented Apr 13, 2023

I now have finally added the API documentation.

Copy link
Owner

@Misterio77 Misterio77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see, everything looks great! I've tested and haven't found any issues, so I think is good to merge :)

I'll look into writing some tests to make these refactors easier in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants