Comments (8)
That does suffice. Thanks for pushing it through so quickly.
from trippy.
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?
from trippy.
Thanks for the quick reply, and consideration!
bat
does this too (search /theme/ in addition to the linked README section).
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 .env
file, instead of as another .config/
.
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.
from trippy.
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 TuiTheme
. This theme is not yet exposed via config and the colors are hardcoded to match the current Trippy style.
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 frequency_chart_bar_color
via something like (mockup):
Command line argument:
trip --tui-theme-frequency-chart-bar-color Red
Environment variable:
TRIP_TUI_THEME_FREQUENCY_CHART_BAR_COLOR=Blue
Config file:
[theme]
frequency_chart_bar_color=#31c2fc
from trippy.
@mcint I've updated the PR (#413) to expose the above theme configuration options via command line arguments:
--tui-theme-bg-color <TUI_THEME_BG_COLOR>
The default background color [default: black]
--tui-theme-border-color <TUI_THEME_BORDER_COLOR>
The default color of borders [default: gray]
--tui-theme-text-color <TUI_THEME_TEXT_COLOR>
The default color of text [default: gray]
--tui-theme-tab-text-color <TUI_THEME_TAB_TEXT_COLOR>
The color of the text in traces tabs [default: green]
--tui-theme-hops-table-header-bg-color <TUI_THEME_HOPS_TABLE_HEADER_BG_COLOR>
The background color of the hops table header [default: white]
--tui-theme-hops-table-header-text-color <TUI_THEME_HOPS_TABLE_HEADER_TEXT_COLOR>
The color of text in the hops table header [default: black]
--tui-theme-hops-table-row-active-text-color <TUI_THEME_HOPS_TABLE_ROW_ACTIVE_TEXT_COLOR>
The color of text of active rows in the hops table [default: gray]
--tui-theme-hops-table-row-inactive-text-color <TUI_THEME_HOPS_TABLE_ROW_INACTIVE_TEXT_COLOR>
The color of text of inactive rows in the hops table [default: dark-gray]
--tui-theme-hops-chart-selected-color <TUI_THEME_HOPS_CHART_SELECTED_COLOR>
The color of the selected series in the hops chart [default: green]
--tui-theme-hops-chart-unselected-color <TUI_THEME_HOPS_CHART_UNSELECTED_COLOR>
The color of the unselected series in the hops chart [default: gray]
--tui-theme-hops-chart-axis-color <TUI_THEME_HOPS_CHART_AXIS_COLOR>
The color of the axis in the hops chart [default: dark-gray]
--tui-theme-frequency-chart-bar-color <TUI_THEME_FREQUENCY_CHART_BAR_COLOR>
The color of bars in the frequency chart [default: green]
--tui-theme-frequency-chart-text-color <TUI_THEME_FREQUENCY_CHART_TEXT_COLOR>
The color of text in the bars of the frequency chart [default: gray]
--tui-theme-samples-chart-color <TUI_THEME_SAMPLES_CHART_COLOR>
The color of the samples chart [default: yellow]
--tui-theme-help-dialog-bg-color <TUI_THEME_HELP_DIALOG_BG_COLOR>
The background color of the help dialog [default: blue]
--tui-theme-help-dialog-text-color <TUI_THEME_HELP_DIALOG_TEXT_COLOR>
The color of the text in the help dialog [default: gray]
The supported colors are Black, Red, Green, Yellow, Blue, Magenta, Cyan, Gray, DarkGray, LightRed, LightGreen, LightYellow, LightBlue, LightMagenta, LightCyan, White
(case insensitive, dashes allowed) or specify a raw hex value (i.e. ffffff
for white).
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.
from trippy.
Reworked the config to avoid having one config option per theme-able item: #443
from trippy.
@mcint support for specify theme colors is now also available in the trippy config file, see #412
from trippy.
@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
from trippy.
Related Issues (20)
- Add silence mode
- [Praise} seriously impressed with this project HOT 3
- No Response lines on an iphone hotspot HOT 8
- Publish musl Linux .deb HOT 2
- Replace unmaintained dependency tui with ratatui HOT 1
- Chocolatey package
- Troubleshooting Windows defender trip.exe added and admin powershell HOT 6
- Add `dot` report mode HOT 2
- Add IPs field to `csv` and all tabular reports
- Bug: process leaks after closing terminal window HOT 6
- Extending Trippy HOT 13
- Only create the required sending socket HOT 2
- Add `--icmp` command line shortcut
- Trippy v0.8.0 Windows 11 HOT 3
- Bug: Ipv4Packet::get_total_length() incorrect byte order
- bug: unnecessary TimeExceededPacket::new_view calls
- Trippy 0.8.0 installed via WinGet stuck at Awaiting Data. HOT 6
- Have `?` be an additional/default shortcut for help HOT 11
- Document Windows Defender post install setup
- Improve command line bool flag handling
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trippy.