-
Notifications
You must be signed in to change notification settings - Fork 284
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
Support COLORTERM for TrueColor ASCII #235
Comments
This is a very good idea @atluft |
Will do, new to Rust programming and having your advice helps. All comments are welcome! |
@atluft Just curious: did you test how the |
Nevermind, I checked the source code and it appears that I think the best way would probably be to have the struct Colors {
default_colors: Vec<Color>,
true_colors: Option<Vec<Color>>,
}
Does that make sense? 😺 |
Thanks, @o2sh! Basically match color {
Color::TrueColor if colorterm_not_set => closest_color_euclidean(color),
_ => color,
} |
I made colored-rs/colored#90 for this. If it doesn't get merged, feel free to copy the code into this project 😃 |
I agree, it would be preferable to have this behavior - fallback to closest Color when TrueColor isn't supported - natively handled by Still, impressive stuff @spenserblack |
I definitely am not rusty enough for this one :-) I will noodle around with @o2sh suggestion above another day, it looks like a good direction. In what I tried today, I had a hard time getting expr tokens to accept a comma suffix followed by a string literal for the languages like "c++". I tried layering the parser so there were several rules for different formats, but it seemed like I could never get all the languages to match a rule or when I did I got End of my day here, have a good day where ever you are! |
That means there's an un-expanded repeating macro pattern somewhere. Here is a minimal reproduction that hopefully clears it up (Rust's compiler errors for macros aren't the best 🙂 ).
No worries, everyone starts as a beginner 😃 👍 |
Thank you @spenserblack, that was a good example. I was thinking the other way around that there weren't enough matches, your example helps clearly see that the |
Not as clean as @o2sh posted and the new macro I begin to wonder, why isn't the color processing in the ascii file?
|
It makes it easier to manage colors - all the coloring is defined in one file (language.rs) - and allows for run-time customization via |
After working on the swift logo I was thinking it might be useful to be able to specify true colors for a better result:
Terminals that don't support COLORTERM environment variable would look like this:
The text was updated successfully, but these errors were encountered: