Bootstrap: By the fly user cnanging lite to dark and back

Hello!!!

As i mention in another recent question though not new in programming, nor xojo (in fact programmer since REALBASIC), the bootstrap not solved yet, but, i question my self, how can i user change, for example, from a lite thema and back with the Bootstrap tecnnology?

help need on the basics too

Regards

You need to use ā€˜Color Modeā€™ for the Session.
The default is Auto.
The documentation is missing this information.
Something like:

Session.ColorMode = WebSession.ColorModes.Dark

if you want to force Dark mode.

3 Likes

I used that in a checkbox ValueChanged event if/else to allow user to change light or dark

If Me.Value  Then
  
  Session.ColorMode = WebSession.ColorModes.Dark
  
Else 
  
  Session.ColorMode = WebSession.ColorModes.Auto
  
End If  

Worked like a charm, just thought I would throw that in :grin:

1 Like

great!
is the colormode related to the bootstrap active?

Xojoā€™s default Bootstrap Theme offer light and dark options.
Xojo by default set the Color Mode to Auto, so if you have your computer in Dark mode you will see the page in Dark mode, if set to Light, then Light.
With the Color Mode option you can put a checkbox (or something else) for your visitors to override the default and force light/dark/auto.
Most Bootstrap 5.x Themes that you download should offer Light/Dark mode (if the Default is not something you like).

the default work perfect, thanks
now i have to learn how to set and custumize the diferent css
next task for me

again , thanks

2 Likes