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

With cli::col_bg_white(), could text be black by default? #693

Closed
olivroy opened this issue May 15, 2024 · 2 comments
Closed

With cli::col_bg_white(), could text be black by default? #693

olivroy opened this issue May 15, 2024 · 2 comments

Comments

@olivroy
Copy link
Contributor

olivroy commented May 15, 2024

In light theme, it looks pretty good.

with theme = Chrome:

cli::bg_white("aaa")

image

On some dark themes, for example, using

rstudioapi::applyTheme('Cobalt')

image

text is not readable.

Could the default be tweaked a bit ? or otherwise, is there a way I can do I do this myself?

Text seems to appear white by default in most bg_*() fn, but on bg_cyan, bg_green, bg_yellow black text seems to be a better choice for readability.

@trevorld
Copy link

You can explicitly set both the background color and foreground color using combine_ansi_styles() e.g.

library(cli)
black_on_white <- combine_ansi_styles(bg_white, col_black)
black_on_white("aaa")

If you're terminal has "truecolor" support then instead of using the system palette "colors" you can even explicitly set the foreground/background colors using "#RRGGBB" color strings using make_ansi_style() (with combine_ansi_styles()).

@gaborcsardi
Copy link
Member

Yeah, we set bg and fg colors independently, and I think for simplicity we should keep it that way.

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

No branches or pull requests

3 participants