Skip to content

feature request: Turn keyword highlighting off #974

@eutwt

Description

@eutwt

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")
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions