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

NA styling #70

Closed
hadley opened this Issue Dec 28, 2017 · 4 comments

Comments

Projects
2 participants
@hadley
Member

hadley commented Dec 28, 2017

I'm not in love with the current treatment. Did we try yellow or red foreground colour?

@krlmlr

This comment has been minimized.

Member

krlmlr commented Jan 10, 2018

Please choose your preference, screenshot taken in RStudio:

screenshot from 2018-01-10 22-14-59

Code to create the matrix:

bg <- c("bgBlack", "bgBlue", "bgCyan", "bgGreen", "bgMagenta", "bgRed", "bgWhite", "bgYellow")
fg <- tolower(gsub("^bg", "", bg))

library(tidyverse)
library(crayon)

combs <- tidyr::crossing(bg, fg)

find_fun <- function(name) {
  get(name, asNamespace("crayon"), mode = "function")
}

combs %>%
  rowwise() %>% 
  mutate(na = find_fun(fg)(find_fun(bg)("NA"))) %>% 
  ungroup() %>% 
  group_by(bg) %>% 
  summarize(na = paste(na, collapse = " ")) %>% 
  ungroup() %>%
  summarize(val = paste0(format(bg), " ", na, collapse = "\n")) %>%
  pull() %>% 
  cat()

@krlmlr krlmlr added this to To Do in krlmlr Jan 10, 2018

@hadley

This comment has been minimized.

Member

hadley commented Jan 10, 2018

Let's try bgRed + white

@hadley

This comment has been minimized.

Member

hadley commented Jan 10, 2018

Actually, let's just try "red" and leave the background colour alone. I think that should be sufficient contrast in most styling configs.

@krlmlr

This comment has been minimized.

Member

krlmlr commented Jan 11, 2018

I do wonder why bgWhite() is so gray on my system...

@krlmlr krlmlr closed this in 7bdf266 Jan 11, 2018

krlmlr added a commit that referenced this issue Jan 11, 2018

Merge tag 'v1.0.99.9000'
- `NA` values are now shown in plain red, without changing the background color (#70).
- New options to control the output, with defaults that match the current behavior unless stated otherwise:
    - `pillar.sigfig` to control the number of significant digits, for highlighting and truncation (#72),
    - `pillar.subtle` to specify if insignificant digits should be printed in gray (#72),
    - `pillar.neg` to specify if negative digits should be printed in red,
    - `pillar.bold` to specify if column headers should be printed in bold (default: `FALSE`, #76),
    - `pillar.min_title_chars` to specify the minimum number of characters to display for each column name (default: 15 characters, #75).
- Shortened abbreviations for types: complex: cplx -> cpl, function: fun -> fn, factor: fctr -> fct (#71).
- Date columns now show sub-seconds if the `digits.secs` option is set (#74).
- Work around failing CRAN tests on Windows.

@krlmlr krlmlr moved this from To Do to Done in krlmlr Jan 14, 2018

krlmlr added a commit that referenced this issue Jan 19, 2018

Merge tag 'v1.1.0'
- `NA` values are now shown in plain red, without changing the background color (#70).
- New options to control the output, with defaults that match the current behavior unless stated otherwise:
    - `pillar.sigfig` to control the number of significant digits, for highlighting and truncation (#72),
    - `pillar.subtle` to specify if insignificant digits should be printed in gray (#72),
    - `pillar.neg` to specify if negative digits should be printed in red,
    - `pillar.bold` to specify if column headers should be printed in bold (default: `FALSE`, #76),
    - `pillar.min_title_chars` to specify the minimum number of characters to display for each column name (default: 15 characters, #75).
- Shortened abbreviations for types: complex: cplx -> cpl, function: fun -> fn, factor: fctr -> fct (#71).
- Date columns now show sub-seconds if the `digits.secs` option is set (#74).
- Very wide tibbles now print faster (#85).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment