renkun-ken / formattable

Formattable Data Structures
Other
693 stars 79 forks source link

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

Open renkun-ken opened 8 years ago

renkun-ken commented 8 years ago

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?

timelyportfolio commented 8 years ago

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

renkun-ken commented 8 years ago

It works fine with light RStudio theme like TextMate:

formattable-htmlwidget-r-notebook2

renkun-ken commented 8 years ago

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

timelyportfolio commented 8 years ago

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.

kevinushey commented 8 years ago

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.

iozeroff commented 4 years ago

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

kmshort commented 4 years ago

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!

ninadicara commented 4 years ago

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))
mexiro commented 3 years ago

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