InioX / matugen

A material you color generation tool
GNU General Public License v2.0
344 stars 18 forks source link

[Bug] Failed to parse custom color: ParseRGB #92

Closed Heus-Sueh closed 4 months ago

Heus-Sueh commented 4 months ago

I was testing some custom colors to use in templates and this bug appeared when trying to run matugen:

Bug:

Opening image in /var/home/heus/Pictures/Wallpapers/beautiful-wallpapers/2023-08-14-11-00-18-bici.jpg
The application panicked (crashed).
Message:  Failed to parse custom color: ParseRGB
Location: src/main.rs:92

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Config.toml

[config.custom_colors]
success = { color = "#1b8553", blend = false }
urgent = { color = "#ff0000", blend = false }
white = { color = "#ffffff", blend = false }
transparent_black = { color = "rgba(0, 0, 0, 0.07)", blend = false }
semi_transparent_black = { color = "rgba(0, 0, 0, 0.8)", blend = false }
light_pastel_blue = { color = "#d7e3f0", blend = false }

Template for gtk

@define-color headerbar_border_color {{colors.semi_transparent_black.default.rgba}};
@define-color headerbar_shade_color {{colors.transparent_black.default.rgba}};
@define-color card_shade_color {{colors.transparent_black.default.rgba}};
@define-color thumbnail_fg_color {{colors.semi_transparent_black.default.rgba}};
@define-color shade_color {{colors.transparent_black.default.rgba}};
@define-color incognito_bg_color {{colors.light_pastel_blue.default.hex}};
InioX commented 4 months ago

This is happening because you have to use hex colors only. I added a note about it in the example config. I just tried adding support for other formats but doing so caused some weird bugs, so I decided not to add anything.

Heus-Sueh commented 4 months ago

Would it be possible to put the alpha value in the hex code or just the 6 values?

InioX commented 4 months ago

I tried using rgba and setting the alpha value to 0.1 but it didn't do anything for some reason.

Heus-Sueh commented 4 months ago

I tried using rgba and setting the alpha value to 0.1 but it didn't do anything for some reason.

strange, so leave support for rgba aside for now