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

Integration with papirus-folders #83

Closed
Heus-Sueh opened this issue Jun 20, 2024 · 19 comments
Closed

Integration with papirus-folders #83

Heus-Sueh opened this issue Jun 20, 2024 · 19 comments
Labels
enhancement New feature or request

Comments

@Heus-Sueh
Copy link

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

@InioX InioX added the enhancement New feature or request label Jun 23, 2024
@InioX
Copy link
Owner

InioX commented Jun 24, 2024

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.

@Heus-Sueh
Copy link
Author

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.

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

InioX added a commit that referenced this issue Jun 25, 2024
InioX added a commit that referenced this issue Jun 28, 2024
@InioX
Copy link
Owner

InioX commented Jun 28, 2024

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}"

@Heus-Sueh
Copy link
Author

In compare_to, can you put a variable, like in the previous example?

like that:
compare_to = "{{colors.primary.default.hex}}"

@InioX
Copy link
Owner

InioX commented Jun 28, 2024

No but I'll make it do that if you want.

@Heus-Sueh
Copy link
Author

No but I'll make it do that if you want.

If there is no negative side, it might be interesting to implement

@InioX
Copy link
Owner

InioX commented Jun 29, 2024

It executes now, so feel free to test stuff.

@Heus-Sueh
Copy link
Author

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?

@InioX
Copy link
Owner

InioX commented Jun 29, 2024

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.

@Heus-Sueh
Copy link
Author

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.

Okay, I was unsure about the name compared_color, sorry my English isn't very good

@InioX
Copy link
Owner

InioX commented Jun 29, 2024

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.

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.

@Heus-Sueh
Copy link
Author

Kooha-2024-06-29-20-19-06.mp4

@Heus-Sueh
Copy link
Author

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

@InioX
Copy link
Owner

InioX commented Jun 30, 2024

Could you post the wallpapers this is happening with?

@Heus-Sueh
Copy link
Author

Could you post the wallpapers this is happening with?

2023-08-14-11-00-18-cat

@Heus-Sueh
Copy link
Author

I will post others

@InioX
Copy link
Owner

InioX commented Jun 30, 2024

Could you post the wallpapers this is happening with?

2023-08-14-11-00-18-cat

This image seems to work fine
image
image

@Heus-Sueh
Copy link
Author

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" }
]

@InioX
Copy link
Owner

InioX commented Jul 1, 2024

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.

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

No branches or pull requests

2 participants