insightsengineering / teal

Exploratory Web Apps for Analyzing Clinical Trial Data
https://insightsengineering.github.io/teal/
Other
171 stars 35 forks source link

[Feature Request]: Use bootstrap theme for all elements #735

Open asbates opened 1 year ago

asbates commented 1 year ago

Feature description

It would be nice to have everything in the app to have the same look and feel if I use anything other than the Shiny default theme. For example if I want to use Bootswatch's Minty theme, I would like the sparklines in the tm_variable_browser table to match.

image

Code of Conduct

Contribution Guidelines

Security Policy

asbates commented 1 year ago

The thematic package might be a quick and easy way to achieve this.

nikolas-burkoff commented 1 year ago

Also note the histogram and labels in the filter panel https://github.com/insightsengineering/teal.slice/pull/164#discussion_r1073787170

asbates commented 1 year ago

Bootstrap 3 doesn't have variables. So we would either need to

  1. Only support bootstrap 4 and higher (I suggest this)
  2. Handle different bootstrap versions differently

For 2, we could for example define CSS variables for bootstrap 3 ourselves and use those or not depending on the version.

asbates commented 1 year ago

Bootstrap uses hex for colors. If we wanted to use primary in the slider histogram for example, we would likely use different different opacity for filtered vs. unfiltered. There's not a direct way to do this in CSS unfortunately.

But luckily, it looks to be fairly easy to do this with JavaScript. We could do the following.

Conversion: https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb.

Updating variables: https://www.w3schools.com/css/css3_variables_javascript.asp and https://css-tricks.com/updating-a-css-variable-with-javascript/.

asbates commented 1 year ago

Just found that Bootstrap 5 also has variables for the colors in rgb.

gogonzo commented 3 months ago

Switching to bslib even more relevant with this item