formattable icon indicating copy to clipboard operation
formattable copied to clipboard

The text color of formattable htmlwidget is too light in R Notebook under dark theme

Open renkun-ken opened this issue 9 years ago • 9 comments

The latest RStudio Preview has supported R Notebook (enable by Global Options -> R Markdown -> Enable R notebook).

However, the color of text in a formattable htmlwidget is too light to see. For example,

library(formattable)
formattable(mtcars, list(mpg = color_tile("white", "lightpink")))

formattable-htmlwidget-r-notebook

@timelyportfolio, any idea on how to fix this?

renkun-ken avatar Jun 04 '16 01:06 renkun-ken

Interesting. Hopefully, I will check it out in the morning.

timelyportfolio avatar Jun 04 '16 02:06 timelyportfolio

It works fine with light RStudio theme like TextMate:

formattable-htmlwidget-r-notebook2

renkun-ken avatar Jun 04 '16 03:06 renkun-ken

Posted an issue at RStudio: https://support.rstudio.com/hc/en-us/community/posts/211637527-The-text-color-of-htmlwidget-can-be-too-light-in-R-notebook-under-dark-themes

renkun-ken avatar Jun 04 '16 03:06 renkun-ken

It appears RStudio is assigning a body color which is impacting the table.

image

I'm not sure internally how RStudio assigns this color. We could add some code, but I think it would better handled on the RStudio end. I wonder what other htmlwidgets might be affected. I'll keep on a dark theme to see what other issues show up.

image

When I choose a light theme as you suggest, the body is assigned color: rgb(0,0,0) so black. I still have not found what code determines color.

timelyportfolio avatar Jun 05 '16 00:06 timelyportfolio

Indeed, RStudio hard-codes the background color as white at the moment, but we should update / set this dynamically based on the theme / HTML widget specification. I'll log this on our internal tracker and try to get this cleaned up before the RStudio release.

kevinushey avatar Jun 08 '16 18:06 kevinushey

I'm still having this problem! Dark mode is formatting my table font color to white.

iozeroff avatar Apr 17 '20 04:04 iozeroff

I'm still having this problem! Dark mode is formatting my table font color to white.

Same here -- funny, after no posts in 4 years, two of us post in 18 minutes!

kmshort avatar Apr 17 '20 04:04 kmshort

Ran into this issue too in a markdown doc and ended up here - I'm displaying it in the Viewer pane as a work around so I can see the table output without changing my theme (and without pushing all output to Viewer)😄

In case helpful for anyone else:

library(formattable)
library(htmltools)

mytable <- formattable(mtcars, list(mpg = color_tile("white", "lightpink")))
html_print(as.htmlwidget(mytable))

ninadicara avatar Aug 13 '20 11:08 ninadicara

The issue is open on rstudio github. https://github.com/rstudio/rstudio/issues/6489

mexiro avatar Dec 07 '20 19:12 mexiro