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

feature request: Turn keyword highlighting off #974

Closed
eutwt opened this issue Aug 13, 2022 · 1 comment · Fixed by #977
Closed

feature request: Turn keyword highlighting off #974

eutwt opened this issue Aug 13, 2022 · 1 comment · Fixed by #977

Comments

@eutwt
Copy link

eutwt commented Aug 13, 2022

I'd like keyword highlighting, but the dark blue is hard to read with a dark grey background. Would be nice if the option allowed specifying a color, but failing that I'd like to be able to turn it off.

library(dplyr, w = F)
library(testthat, w = F)
#> Warning: package 'testthat' was built under R version 4.1.2
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
copy_to(con, mtcars)
mtcars2 <- tbl(con, "mtcars")

local_reproducible_output(crayon = TRUE)
options(dbplyr_use_colour = FALSE)

mtcars2 %>% 
  select(mpg) %>% 
  show_query()
#> <SQL>
#> �[34mSELECT�[39m `mpg`
#> �[34mFROM�[39m `mtcars`

Created on 2022-08-13 by the reprex package (v2.0.1.9000)

My workaround for now is below, but it would be nice if there was an option

style_kw <- function(x) {
  if (dbplyr:::dbplyr_use_colour()) {
    # use `br_blue` which is more legible for a dark theme
    cli::col_br_blue(x)
  } else {
    x
  }
}
 
assignInNamespace(
  "style_kw", 
  style_kw,
  asNamespace("dbplyr")
)
@eutwt eutwt changed the title How to turn keyword highlighting off feature request: Turn keyword highlighting off Aug 14, 2022
@mgirlich
Copy link
Collaborator

Totally makes sense! 👍

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

Successfully merging a pull request may close this issue.

2 participants