Tomas-M / iotop

A top utility for IO
Other
376 stars 50 forks source link

Display output enhancement #31

Closed gsmitheidw closed 2 years ago

gsmitheidw commented 2 years ago

It would be a useful enhancement to add colours and even themes to the displayed output. Colours make highlighting or identifying things easier at a glance. A monochrome only switch may also be needed for some older or more basic terminals that don't support ansi colour codes.

It might be also nice to be able to customise the characters in the graph column to use Unicode block style characters instead of dot style ones.

bbonev commented 2 years ago

I have been thinking about adding colors since some time but couldn't clearly define that yet. Maybe one path is to borrow the idea from iostat? If you can help with the definition, I am all ears :)

The charm of the braille chars is that there are two values per character. Going for Unicode will give a single value per character (as in ASCII mode) but with vertical resolution of 8 instead of 4. I can't say which is better though...

gsmitheidw commented 2 years ago

I suppose the classic model is the traffic light - green for smaller io loads and progression to red for higher io graph.

Other than that it it's just a matter of personal aesthetic, maybe alternate colours for each column and maybe something contrasting for the column label bar.

Then the only other consideration is whether the terminal is light or dark background - to avoid dark blue on black or yellow on white etc for visibility. So probably needs a -dark and -light in case terminal defaults cannot be determined.

It could support themes but whilst there's value in making extremities stand out with colour, it shouldn't lose sight of the fact this is a very useful and serious utility rather than just eye candy. It's akin to the genuine usefulness of grep --color rather than just piping some command through "lolcat".

bbonev commented 2 years ago

I didn't add 256 color support (like lolcat), but made it use the predefined colors, so there is no possibility for defining built-in color theme. Whatever the default colors are, those are used. In this way of thought, about dark vs light themes - this is a problem with the terminal (the bug with A_DIM on a light theme) and should be solved there.

One thing that may become configurable are the boundaries - currently 0-10-40-80-100

You can check the change here: https://github.com/bbonev/iotop/commit/4ba8bb40d4e8990a0b6ac00cb674fac305927077

I will close the issue, but if there is something to add, please do.