-
-
Notifications
You must be signed in to change notification settings - Fork 95
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 light background terminal in TUI mode #411
Comments
Thanks for raising this @mcint, customising the theme isn't something trippy supports today but I like the idea. I think the best way to achieve this may be to have a trippy config file (similar to the one I proposed in #412) that allow specifying the colors for various parts of the TUI, rather than the current hardcoded approach. What do you think? |
Thanks for the quick reply, and consideration!
I'm less a fan of custom configuration, and one more config file. I would love environment variables, for explicit color setting (/overriding) or also a separate one for theme selection. I frequently find that environment variables are quick to override for exploration or adapting to the demands of a task, and can live in my It looks like you have other reasons for considering a config file, and given the TUI nature of the primary interface, trippy is more primarily used interactively than in shell pipelines. I think I'd recommend a review of other TUIs to make the decision, htop, wireshark, mtr. Maybe I can write a short blog post in review. Basically unrelated, I sure wish these theme files could be shared across bat, trippy, *vim, and others, ideally in the same directory, or at least built from shared definitions. |
I agree that Trippy is primarily a Tui application and therefore being able to configure it via the environment makes sense in the spirit of 12 factors app. I would like users to be able to specify any Trippy configuration as config file entries, environment variables or command line arguments (in priority order args -> env -> file). There are some good rust crates to help with this, though none that I've seen which support Clap natively. But ultimately this shouldn't be too difficult to piece together manually. Aside from how it is configured, I've created a PR (#413) which replaces all the hardcoded Tui colors with a This was a useful exercise as it forced me to think about the specific color theme parameter that will be exposed in the configuration. Currently the theme allows customising the following: pub struct TuiTheme {
/// The default background color.
///
/// This may be overridden for specific components.
bg_color: Color,
/// The default color of borders.
///
/// This may be overridden for specific components.
border_color: Color,
/// The default color of text.
///
/// This may be overridden for specific components.
text_color: Color,
/// The color of the text in traces tabs.
tab_text_color: Color,
/// The background color of the hops table header.
hops_table_header_bg_color: Color,
/// The color of text in the hops table header.
hops_table_header_text_color: Color,
/// The color of text of active rows in the hops table.
hops_table_row_active_text_color: Color,
/// The color of text of inactive rows in the hops table.
hops_table_row_inactive_text_color: Color,
/// The color of the selected series in the hops chart.
hops_chart_selected_color: Color,
/// The color of the unselected series in the hops chart.
hops_chart_unselected_color: Color,
/// The color of the axis in the hops chart.
hops_chart_axis_color: Color,
/// The color of bars in the frequency chart.
frequency_chart_bar_color: Color,
/// The color of text in the bars of the frequency chart.
frequency_chart_text_color: Color,
/// The color of the samples chart.
samples_chart_color: Color,
/// The background color of the help dialog.
help_dialog_bg_color: Color,
/// The color of the text in the help dialog.
help_dialog_text_color: Color,
} You could imagine, therefore, being able to override the Command line argument:
Environment variable:
Config file:
|
@mcint I've updated the PR (#413) to expose the above theme configuration options via command line arguments:
The supported colors are If would be great if you were able to give that a try and give some feedback on whether it allows you to customise the theme as you would like. If so then I'd look to merge this. Obviously it is impractical to specify so many theme parameters from the command line, so the next step would be to expose these, and other trippy config, as both config files and environment variable as as described above. |
That does suffice. Thanks for pushing it through so quickly. |
Reworked the config to avoid having one config option per theme-able item: #443 |
@mcint 0.8.0, which includes a config file for specifying TUI themes, to has been released: https://github.com/fujiapple852/trippy/releases/tag/0.8.0 |
It looks like TUI mode is the only one that accepts multiple hosts, and that this tool is mainly built around the TUI. How do I use this with a light terminal background? Can I override the color scheme with something akin to LS_COLORS, or a theme flag?
The text was updated successfully, but these errors were encountered: