Skip to content
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

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

Open
leonqli opened this issue Feb 16, 2022 · 3 comments
Open

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

leonqli opened this issue Feb 16, 2022 · 3 comments

Comments

@leonqli
Copy link

leonqli commented Feb 16, 2022

Thanks!

@nojhan
Copy link
Owner

nojhan commented Feb 16, 2022

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?

@leonqli
Copy link
Author

leonqli commented Feb 16, 2022

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

@nojhan
Copy link
Owner

nojhan commented Mar 28, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants