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

NA styling #70

Closed
hadley opened this issue Dec 28, 2017 · 5 comments
Closed

NA styling #70

hadley opened this issue Dec 28, 2017 · 5 comments

Comments

@hadley
Copy link
Member

hadley commented Dec 28, 2017

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

@krlmlr
Copy link
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()

@hadley
Copy link
Member Author

hadley commented Jan 10, 2018

Let's try bgRed + white

@hadley
Copy link
Member Author

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
Copy link
Member

krlmlr commented Jan 11, 2018

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

@krlmlr krlmlr closed this as completed in 7bdf266 Jan 11, 2018
krlmlr added a commit that referenced this issue Jan 11, 2018
- `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 added a commit that referenced this issue Jan 19, 2018
- `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).
@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2020

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants