DT::datatable set color of control elements text in shiny

I have a shiny app with a dark theme and I'd like to color the text elements surrounding the table white with a black background. The background of table border region is already dark because I am using the 'darkly' shiny theme. The snippet below from right here (thanks!) covers the column labels but, for the life of me, I can't find how to specify the text that labels the control elements (called DOM elements in the examples here).

datatable(head(iris, 20), options = list(
  initComplete = JS(
    "function(settings, json) {",
    "$(this.api().table().header()).css({'background-color': '#000', 'color': '#fff'});",
    "}")
))

I've tried adding a many permutations of a line modeled on the header example but I suspect I can't find the right class name. The code below doesn't work. It changes the column headers but has no other effect.

datatable(head(iris, 20), options = list(
  initComplete = JS(
    "function(settings, json) {",
    "$(this.api().table().header()).css({'background-color': '#000', 'color': '#fff'});",
    "$(this.api().table().control()).css({'color': '#fff'});",
    "}")
))

My Javascript/HTML skill level is "cut and paste." Thanks.

1 Like

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.