teal icon indicating copy to clipboard operation
teal copied to clipboard

[Feature Request]: Use bootstrap theme for all elements

Open asbates opened this issue 2 years ago • 6 comments

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

  • [X] I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • [X] I agree to follow this project's Contribution Guidelines.

Security Policy

  • [X] I agree to follow this project's Security Policy.

asbates avatar Sep 22 '22 20:09 asbates

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

asbates avatar Sep 22 '22 20:09 asbates

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

nikolas-burkoff avatar Jan 19 '23 11:01 nikolas-burkoff

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 avatar Jan 20 '23 23:01 asbates

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.

  • Read in primary color and convert to rgb with the desired opacity.
  • Write this out to a variable or overwrite a variable.

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 avatar Mar 08 '23 21:03 asbates

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

asbates avatar Apr 26 '23 22:04 asbates

Switching to bslib even more relevant with this item

gogonzo avatar May 24 '24 07:05 gogonzo