-
-
Notifications
You must be signed in to change notification settings - Fork 285
treewide: replace custom color scheme generator with Matugen #892
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
base: master
Are you sure you want to change the base?
Conversation
e2acb6c to
12a92ea
Compare
|
primaryScale parameters have been implemented |
danth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely an improvement over the current generator, at least when I tried it on my own wallpaper :)
As this is still a WIP I've just left a couple of comments.
|
Okay, I'll work on cleaning this up, do I remove the code for the old palette-generator or do I make an option to have it be selectable for legacy purposes? |
|
I fixed all of the issues that you brought up. |
|
Do you want me to create a gallery of different color scheme options? |
|
although for some reason, i can't get the removed option warning to show up |
|
that was an easy fix... |
|
very cool! will this be able to extend to generating a base24 or vim highlight group scheme? |
|
The base16 palette colors are exposed through As for base24 support that'd just involve exposing an extra 8 colors (matugen generates more colors than we use so that is definitely possible) and could probably be done if the project owners were okay with doing so. Although that would then force people to add the extra 8 colors if they want to import their own color palette and as of now no theme would take advantage of the extra colors. |
awesome! that's good futureproofing and tackling #252 |
The current palette generator was designed essentially through trial and error, so I'm not surprised that matugen is a lot better at generating nice looking themes. I would just remove it. (Some more history - the original idea for Stylix was to take just a single option, that being the wallpaper, and do everything automatically from there. This is why the palette generator exists, and why #200 was an issue for so long.) Anyone who wants to continue using a color scheme from the old palette generator may read |
|
I'm also not sure about the colors I have assigned to the Base16 colors based off what matugen returns. I went with what looked good to me but they might need reassigning... |
|
(also that last commit seems to have broken some things...) |
make-42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not for different base16 color assignments, it should be good to go.
|
CI is failing. Maybe a |
|
Let's see |
|
|
|
Might be easier to create a new branch and apply my changes from there instead of rebasing... Will do that instead... |
|
still fails... |
|
maybe it's because the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem might come from:
error: attribute 'themeGeneration' missing
at /nix/store/227sl460khj2ld3y39a4qkg353vz7s21-source/stylix/testbed.nix:142:13:
141| testbed.name
142| stylix.themeGeneration.polarity
| ^
143| "image${lib.optionalString (stylix.image or null == null) "less"}"
Also, consider removing the hlint and stylish-haskell pre-commit hooks in /flake.nix.
|
Why should I put instead? |
|
Oh but stylix is redefined just before so that's normal I suppose. |
|
okay all tests pass except deadnix telling me that i need to remove the |
I think you are supposed to replace the instances with just: args: |
After lots of investigation and experimentation, here are my relevant findings:
Although the current mapping is the best one, it comes nowhere near the quality of the current custom base16 palette generator. While most of my mapping attempts output nonsense, even the currently best mapping results in illegible scenarios. I also took the liberty to push some changes.
Either conversion direction is very lossy and suboptimal. I doubt an optimal mapping exists.
AFAICT, since Matugen is for our purposes "just" a thin https://crates.io/crates/material-colors CLI wrapper, extending it with base-n support seems very out of scope.
Considering Material You's inherently poor base-n conversion, I believe it would be better to entirely avoid it. What about using a custom base-n palette generator and a Material You palette generator? In that case, this PR would merely add Matugen as a semantic representation. Before drastically shifting the scope of this PR, it would be better to first come to a general consensus. Eventually replacing our Haskell implementation with a faster one is still relevant. Ideally, a true base-n palette generator exists to avoid upscaling base16 to base24 through interpolation. |
|
What if we go to a cromatic circle kind of approach where the image helps decide the color part but the brightness and saturation depends on user presets? Like if the user wants more colorful increase the saturation, wants darker reduce brightness. I wanted to test with oklch for that and then convert the colors to the RGB space so programs can use it. Maybe leaving the color chooser logic open or with a opinionated preset but allowing the user to override it, then the user can decide which colorscheme generator likes best or let them create their own. |
Full agreement. I would like to accept matugen as a generator for Material You themes as stylix already includes some applications that are better styled with that than base16. I am working on a base16 generator. Is there a style guide for base24?
I used oklch and kclustering with selective dropout and early stopping to make sure we cover full colors even if the picture isn't very colorfull. It also can calculate primary/secondary colors. So far the results are pretty good. I just need to make it performant and also make some special adjustments for colorblind people that will be optional. |
How would this specifically compare to Either way, adding advanced palette generator customizations should be considered at a later stage, as it is mostly speculative as this point. The interface and implementation might vastly differ depending on the number of palette generators. Very advanced palette generator customizations should be possible with #1956, although its implementation also vastly depends on the number of palette generators.
I do not mean to discard your https://github.com/Mikilio/base16-generator efforts, but do base16 color scheme generators not already exist? For example, the results of the current Haskell implementation are already fairly good.
What if an application supports base32 or base64? Ideally, the palette generator algorithm is base-n generic. Assuming some level of research goes into developing high-quality base16 color scheme generators, it would be better to extend an existing high-quality implementation instead of reinventing the wheel. Unless we are sure that the base16 to base-n generalization requires a complete redesign, we should extend an existing implementation. It might be best to first answer the following questions:
Here are my answers: (1) Yes. (2) Very low priority. (3) Low priority: Since the only benefit is higher accuracy by avoiding upscale interpolation, this can be ignored for now. CC: @0xda157, @Flameopathic, @danth |
Not to disregard the efforts of the Haskell implementation. But I wouldn't put in the effort if I did agree with this statement. I also couldn't find a base theme generator from images that is genuinely good. The Haskell algorithm is probably a really nice piece of software, but the reason I believe it is lacking is that the fitness score is not calculated based on criteria that are significant for a "good" base16 theme.
It is not correct to assume that there is somehow a agnostic way to generate these. That is also something that bothers me about the haskell generator, except for the background it treats all colors the same even though every color has a distinct purpose. With respect to base24<->base16 conversion seems to be possible without issue using the base24builder by the creator of base24. I have now added explanations to the experiment's notebook in https://github.com/Mikilio/base16-generator. Any further commits will only be for the actual performant implementation of this method. That being said, if anyone likes the bold and monochrome themes of the Haskell generator, they are free to use those. |
matugen: formatting matugen: obsidian polarity fix
Signed-off-by: Louis Dalibard <[email protected]>
Signed-off-by: Louis Dalibard <[email protected]>
Signed-off-by: Louis Dalibard <[email protected]>
Signed-off-by: Louis Dalibard <[email protected]>
Signed-off-by: Louis Dalibard <[email protected]>
Signed-off-by: Louis Dalibard <[email protected]>
CC: @0xda157 Signed-off-by: Louis Dalibard <[email protected]>
…olarity option in the vicinae module matugen: doc changes, palette examples, formatting changes, correct polarity option in the vicinae module
Co-authored-by: NAHO <[email protected]>







This PR is meant to further the discussion in (#694).
I believe matugen could be a good candidate for replacing the builtin color scheme generation engine stylix currently uses and this PR serves as a demo for it.
The code is not final:
darkerandeven-darkerpolarities #694However this is what it looks like:

Closes: #269
Closes: #1862