Open Heus-Sueh opened 2 weeks ago
After a bit of thinking, I wanted to make this a bit more flexible and not just lock it to the colors for papirus-folders.
I thought about adding something like this:
colors_to_compare = [
{ name = "white", color = "#ffffff" },
{ name = "black", color = "#000000" }
]
compare_against = "primary"
Matugen would loop over all the colors, compare them with the other color and output the closest one inside of the list by using the --json
flag. You could then pipe it into something like jq
and do stuff based on what the color is.
I'm not sure if this is the best way or the easiest one, if you have any other ideas feel free to share them.
After a bit of thinking, I wanted to make this a bit more flexible and not just lock it to the colors for papirus-folders.
I thought about adding something like this:
colors_to_compare = [ { name = "white", color = "#ffffff" }, { name = "black", color = "#000000" } ] compare_against = "primary"
Matugen would loop over all the colors, compare them with the other color and output the closest one inside of the list by using the
--json
flag. You could then pipe it into something likejq
and do stuff based on what the color is.I'm not sure if this is the best way or the easiest one, if you have any other ideas feel free to share them.
I think this flexibility is the correct path, and I want to suggest perhaps the concept of hook, like this:
[template.papirus-folders]
colors_to_compare = [
{ name = "white", color = "#ffffff" },
{ name = "black", color = "#000000" }
]
compare_against = "primary"
chosen_color = "result_of_compare"
hook = 'papirus-folders -C {chosen_color} --theme Papirus-Dark'
matugen already has this with gtk (when running matugen it will call the hook that will use gsettings to set adw-gtk), but it is harcoded just for him, maybe making this flexible for templates would be interesting, like this:
{ input_path = 'path', output_path = 'path', hook = 'sway reload' }
I saw this hook concept in this program: https://github.com/Misterio77/flavours?tab=readme-ov-file#setup
I forgot to make them execute stuff, I'll fix it later. For now, here's an example for the hook:
[templates.name1]
input_path = "example/colors.whatever-extension"
output_path = "example/a/colors-generated.whatever-extension"
colors_to_compare = [
{ name = "black", color = "#000000" },
{ name = "red", color = "#ff0000" },
{ name = "maroon", color = "#800000" },
{ name = "yellow", color = "#ffff00" },
{ name = "olive", color = "#808000" },
{ name = "lime", color = "#00ff00" },
{ name = "green", color = "#008000" },
{ name = "aqua", color = "#00ffff" },
{ name = "teal", color = "#008080" },
{ name = "blue", color = "#0000ff" },
{ name = "navy", color = "#000080" },
{ name = "fuchsia", color = "#ff00ff" },
{ name = "purple", color = "#800080" },
]
compare_to = "#aefbd5"
hook = "source color {source_color}, source image {source_image}, compared color {compared_color}"
In compare_to
, can you put a variable, like in the previous example?
like that:
compare_to = "{{colors.primary.default.hex}}"
No but I'll make it do that if you want.
No but I'll make it do that if you want.
If there is no negative side, it might be interesting to implement
It executes now, so feel free to test stuff.
In the case of papirus-folders I don't need an input
or output
, I just need the result of comparing all those variables and which one is closest to the generated color colors.primary.default.hex
, so that I call the hook to start the command with the closest color
[templates.papirus-folders]
colors_to_compare = [
{ name = "adwaita", color = "#aacae8" },
{ name = "blue", color = "#7cabe2" },
{ name = "breeze", color = "#7fc4e9" },
{ name = "carmine", color = "#b54142" },
{ name = "darkcyan", color = "#72bbc4" },
{ name = "green", color = "#a1bf80" },
{ name = "indigo", color = "#838dca" },
{ name = "nordic", color = "#9db4cb" },
{ name = "palebrown", color = "#d6c9bd" },
{ name = "pink", color = "#ec87a9" },
{ name = "teal", color = "#159a80" },
{ name = "white", color = "#e4e4e4" },
{ name = "yellow", color = "#f3c863" },
{ name = "black", color = "#797979" },
{ name = "bluegray", color = "#869aa4" },
{ name = "brown", color = "#bda68e" },
{ name = "cyan", color = "#41c7d8" },
{ name = "deeporange", color = "#e98a68" },
{ name = "grey", color = "#a6a6a6" },
{ name = "magenta", color = "#d192e0" },
{ name = "orange", color = "#eba96a" },
{ name = "paleorange", color = "#ebd1a7" },
{ name = "red", color = "#e27c7c" },
{ name = "violet", color = "#9b7fcb" }
]
compare_to = "{{colors.primary.default.hex}}"
hook = "papirus-folders -C {closest_color} --theme Papirus-Dark"
Would it be a good idea to implement this, these "special" cases?
I already added the {{ compared_color }}
, which is just like {{ closest_color }}
you mentioned. I also wanted to add the same formatting for hook
as in the templates, and I will also add the same formatting for compare_to
.
I already added the
{{ compared_color }}
, which is just like{{ closest_color }}
you mentioned. I also wanted to add the same formatting forhook
as in the templates, and I will also add the same formatting forcompare_to
.
Okay, I was unsure about the name compared_color
, sorry my English isn't very good
I already added the
{{ compared_color }}
, which is just like{{ closest_color }}
you mentioned. I also wanted to add the same formatting forhook
as in the templates, and I will also add the same formatting forcompare_to
.Okay, I was unsure about the name
compared_color
, sorry my English isn't very good
I decided to rename it, closest_color
seems better.
Also added formatting to compare_to
as well, so you can now use all the color keywords inside it.
Testing here, in some wallpapers it gets it right, in others it refuses and chooses only the black
color from the papirus-folders
, even though a wallpaper has a lot of blue, it chooses black
.
here is a "log": https://privatebin.net/?d6d1d2d127729ad0#5tPASKCQSTQi3iXuNNnDn7pskwnR6ZJoGDjbyVdArMBM
Could you post the wallpapers this is happening with?
Could you post the wallpapers this is happening with?
I will post others
Could you post the wallpapers this is happening with?
This image seems to work fine
I was testing these colors which would be the colors of the papirus-folders folders that I got using the color picker, would it be better to use the template you provided?
colors_to_compare = [
{ name = "adwaita", color = "#93c0ea" },
{ name = "blue", color = "#5294e2" },
{ name = "breeze", color = "#57b8ec" },
{ name = "carmine", color = "#a30002" },
{ name = "darkcyan", color = "#45abb7" },
{ name = "green", color = "#a1bf80" },
{ name = "indigo", color = "#838dca" },
{ name = "nordic", color = "#9db4cb" },
{ name = "palebrown", color = "#d6c9bd" },
{ name = "pink", color = "#ec87a9" },
{ name = "teal", color = "#159a80" },
{ name = "white", color = "#e4e4e4" },
{ name = "yellow", color = "#f3c863" },
{ name = "black", color = "#797979" },
{ name = "bluegray", color = "#869aa4" },
{ name = "brown", color = "#bda68e" },
{ name = "cyan", color = "#41c7d8" },
{ name = "deeporange", color = "#e98a68" },
{ name = "grey", color = "#a6a6a6" },
{ name = "magenta", color = "#d192e0" },
{ name = "orange", color = "#eba96a" },
{ name = "paleorange", color = "#ebd1a7" },
{ name = "red", color = "#e27c7c" },
{ name = "violet", color = "#9b7fcb" }
]
I would use the papirus-folders colors and maybe add some middle colors, while naming it the same as the color you want to get.
I'm almost reaching the perfect rice, but I didn't find an easy way to select the available colors of papirus-folders based on accent_color in matugen
https://github.com/PapirusDevelopmentTeam/papirus-folders