Dark/Light Theme linked to a user account

0
I'm currently looking for a way to integrate a dark & light theme into an app which changes based on a button click that's linked to a User account. I had been following this blog post https://www.mendix.com/blog/how-to-implement-dark-mode-in-your-apps/ but in our case we cannot link it to a current session. Any suggestions are welcome, thanks.
asked
2 answers
0

Hi Jamie,

I have implemented exactly what you want, also using suggestions from that post. I have put buttons in my layout, 

darktheme7.png

darktheme6.png

 

What do you mean you cannot link to a current session? I have done it like this.

darktheme4.png

 

This is nanoflow behind my 'moon' button. 

darktheme5.png

With JS code: 

import "mx-global";

import { Big } from "big.js";

export async function JS_DarkMode_Enable(isEnabled) {

document.body.classList.add("darkmode");

}

 

And 'Sun' button has just IsEnabled set to false, and code  document.body.classList.remove("darkmode");

answered
2

Here are the images

darkmode_1.png

darkmode_2.png

darkmode_3.png

darkmode_4.png

darkmode_5.png

answered