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
Add uicolor option #271
Add uicolor option #271
Conversation
Updated to also pass tests now. I hope I did that part correctly. Should I also add a test to make sure that these style options are applied? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to contribute!
You're on the right track, though I wonder if we should make the change in a slightly different place (see comments). And yes, a test would be great!
Separately, you may also want to add a command-line argument option for this in src/bin/flamegraph.rs
.
After adding the binary flag in the latest commit, this is now failing on my local machine with
It feels like those things shouldn't be related, right? |
I agree. Our tests don't generally fail spuriously so it's a bit concerning, but unlikely to be related to your change 🤔 Also, looks like there's a conflict with |
src/bin/flamegraph.rs
Outdated
default_value = defaults::UI_COLOR, | ||
value_parser = |s: &str| { | ||
parse_hex_color(s) | ||
.ok_or_else(|| format!("unknown ui color: {}", s)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's be a little more helpful here. Something along the lines of "expected a color in hexadecimal format"
Turns out the reason those tests were failing was that I forgot The UiColor struct was not intentional, I initially started out trying to use it instead of just using |
Oh, and would you mind also updating the CHANGELOG file? |
Updated with all three changes |
Codecov ReportBase: 90.32% // Head: 90.28% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #271 +/- ##
==========================================
- Coverage 90.32% 90.28% -0.04%
==========================================
Files 19 19
Lines 4226 4219 -7
==========================================
- Hits 3817 3809 -8
- Misses 409 410 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
#[clap( | ||
long = "uicolor", | ||
default_value = defaults::UI_COLOR, | ||
value_parser = |s: &str| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value_parser
was added in clap 3.2.0
, so you'll have to update Cargo.toml
to have that be the required version, then this should work 👍
Published as 0.11.13 🎉 |
I wanted to embed the flamegraphs in a html document with a dark theme. While setting the background works fine, I couldn't find a way to the text color of the "UI elements", so this is an attempt to add that option.
Here is an example with a dark background but white uicolor.
The search button is quite faint here, maybe I should do something about that
Should I also add these options to the CLI part? For my personal use, the library part is enough, but I suppose others may want it via CLI.
I'm very unfamiliar with this code base, so let me know if this is not the right way to do it. Also, feel free to disregard if this is out of scope