colout icon indicating copy to clipboard operation
colout copied to clipboard

Is there a theme to color TSV (or CSV) output by column?

Open leonqli opened this issue 2 years ago • 3 comments

Thanks!

leonqli avatar Feb 16 '22 11:02 leonqli

The question is ambiguous in many ways, but my wild guess is that it is easily feasible without needing a theme, for instance: cat file.csv | colout --colormap "([^,]*),*" blue,yellow" gives something like: colout_csv

Is it what you want to achieve?

nojhan avatar Feb 16 '22 18:02 nojhan

Thanks @nojhan ! It is very similar already!

The following screenshot is colored in vim with the plugin rainbow_csv. I wonder if it could be done with colout in output and/or if it is worth the effort to create an theme.

image

leonqli avatar Feb 16 '22 21:02 leonqli

I did not succeed to find a vanilla way to do that, the best I came up with would be:

cat file.csv | colout -g $(for i in $(seq 1 7); do echo -n "([^,]*),*"; done) rainbow

(Which requires to know in advance the number of columns).

Now I'm thinking of what would be the best option to integrate that as a feature. So far I'm thinking of:

  • Add an option to reset the colormap counting after each line.
  • Put the random seed within this reset.

This would allow to use both rainbows and random colormaps in such a way.

nojhan avatar Mar 28 '22 13:03 nojhan