rstudio / rstudio/bslib

Docs: Document choose light or dark theme for sidebars

Open
#867 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SCSS
Stars
569
Forks
72
Avg merge
1d 2h
Merged PRs (30d)
5

Description

If you're creating a sidebar with a dark background in an otherwise light theme, sidebar() will at least choose the contrasting light color for the foreground color. But there will still be many elements that may have inappropriate styles.

One potentially easy way to fix this is to use the dark color mode styles for everything, locally scoped to the sidebar:

layout_sidebar(
  sidebar = sidebar(
    title = "Sidebar",
    p("Light text on a dark background."),
    actionButton("click_me", "Click Me"),
    bg = "purple",
    "data-bs-theme" = "dark"
  ),
  h3("Main content"),
  p("Dark text on a light background.")
)

image

This might not be a complete fix, depending on the dark color mode styles for your current theme, but it can often get you very close to where you want to be.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the sidebar() and layout_sidebar() documentation and review the shown data-bs-theme = "dark" example against the existing theme guidance. Done means the docs explain how to scope dark color-mode styles to a sidebar in an otherwise light layout, including the limitation that results depend on the current theme.

Written by the indexing model from the issue text.

Assessment

Tech stack
bootstrap, r
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.