pillar icon indicating copy to clipboard operation
pillar copied to clipboard

Theming

Open krlmlr opened this issue 7 years ago • 9 comments

Specify color (foreground and background) for:

  • subtle style (perhaps in the gray## syntax)
  • rowid style
  • negative numbers
  • NA
  • groups of three digits

Could be implemented as a separate option for each color, and/or as two sets of options, one for light, one for dark backgrounds.

krlmlr avatar Jan 11 '18 08:01 krlmlr

Would the bold/italic font styles for table headers fall into this as well?

dpeterson71 avatar Jan 11 '18 17:01 dpeterson71

We'd need to think how to encode this in options. Maybe we could support formatter functions as options?

krlmlr avatar Jan 12 '18 22:01 krlmlr

@s-fleck: What would be a good way for pillar to make use of colt's themes?

krlmlr avatar Jan 14 '18 17:01 krlmlr

colt is just a thin wrapper around crayon. So instead of crayon::red() you would use colt::clt_chr_accent(). colt::clt_chr_accent() then applies whatever function is defined in the currently active colt theme (in this case getOption("colt.theme")$clt_chr_accent()) . A colt theme is just list of functions with predefined element names.

When I decided on which theme-elments go in colt, I tried to orient myself after existing packages (mostly tidyverse and what I needed for my packages). For example, there is already colt::clt_chr_subtle() which is inspired by pillar:::style_subtle().

s-fleck avatar Jan 14 '18 18:01 s-fleck

When this is implemented, there needs to be a default theme like plr_theme.classic which prints tibbles in their original format. The more I use the latest version of tibble with the pillar formatting the more frustrated I become. I can NEVER seem to get the output of a tibble to look right now. I just really REALLY want to remove all of the extra formatting that pillar is doing. NO BOLD/ITALIC. NO ARTIFICIAL HIGHLIGHTING. NO ARTIFICIAL CHOICES OF FORCING EVERY COLUMN TO BE THE SAME WIDTH/HAVE THE SAMER DIGITS. Just print the column types as base-R would. I have lost so much productivity fighting with this over the last week it's ridiculous.

dpeterson71 avatar Jan 16 '18 15:01 dpeterson71

@dpeterson71 colt does not support by-package color themes, but its easy to disable colors for all packages that use colt (well, right now there is only one on CRAN, but in theory ;) )

I also agree that while I find the formatting of pillar useful if you deal with large doubles, it makes most of my tables look weird. For example I often have a "year" column in my data, where the last digit (the most important one in this case) is grayed out by default. Also the bold column headings seem to mess formatting up on my work computer.

s-fleck avatar Jan 17 '18 15:01 s-fleck

@krlmlr cant wait for this theming option!

Totally agree with @dpeterson71 . Default should be ol good black 'n gray tibbles with no formatting. As discussed in other threads there are some formatting choices which are quite controversial and even dangerous for the uninformed user.

Then, more advanced users can have fun with the other themes available, with full knowledge of what they are signing for.

Thanks again!!!

tibbles, tibbles everywhere image

randomgambit avatar Mar 02 '18 18:03 randomgambit

Please add a way to turn off the underline of groups of three.

AB-Kent avatar Mar 14 '18 20:03 AB-Kent

@dpeterson71 This is a bit late, but set the NO_COLOR env var to true and then all formatting is removed.

gaborcsardi avatar Jun 30 '22 19:06 gaborcsardi