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

Whiskers breaks on some specific color overrides #32

Open
dacid44 opened this issue Jul 17, 2024 · 2 comments
Open

Whiskers breaks on some specific color overrides #32

dacid44 opened this issue Jul 17, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@dacid44
Copy link

dacid44 commented Jul 17, 2024

When run with zed.tera, with a specific color override:

whiskers zed.tera -o json --color-overrides '{"all": {"text": "ff832b"}}'

whiskers crashes with the message:

thread 'main' panicked at /home/dacid44/.cargo/registry/src/index.crates.io-6f17d22bba15001f/css-colors-1.0.1/src/ratio.rs:38:9:
Invalid ratio for type f32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Changing the color to something slightly different (e.g. fe832b) fixes the error.

@dacid44
Copy link
Author

dacid44 commented Jul 17, 2024

Actually, it looks like this is a bug in the css-colors crate. This code panics with the same error:

use css_colors::{rgb, Color};

fn main() {
    let weird_color = rgb(255, 131, 43); // #ff832b
    let weird_color_hsl = weird_color.to_hsla();
    println!("Hello, world!");
}

Unfortunately, I don't think it's likely that that crate is going to be patched anytime soon. The last commit is from 5 years ago, and seems completely dead. Their issue tracker is all old and unanswered stuff too.

@backwardspy
Copy link
Member

that is interesting, thanks for raising this! i suspect you're right. i have a few ideas already for replacing css-colors.

i will have a look into this and see what to do about working around it or fixing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants