chainlit icon indicating copy to clipboard operation
chainlit copied to clipboard

How to load Dark Mode by default?

Open shawsa-artc opened this issue 2 years ago • 3 comments
trafficstars

I only need dark mode, how can i load dark mode by default?

shawsa-artc avatar Nov 20 '23 10:11 shawsa-artc

As of now the first load is based on the system preference, then if the user changes the theme, the new preference is stored in the local storage.

willydouhard avatar Nov 20 '23 13:11 willydouhard

As of now the first load is based on the system preference, then if the user changes the theme, the new preference is stored in the local storage.

can we have this as a parameter in config.toml?

shawsa-artc avatar Nov 21 '23 05:11 shawsa-artc

@shawsa-artc You can easily do this using custom js file.

Add a custom.js file with the below content, under the public directory:

eval(console.log('Setting the default theme as dark.'));
eval(localStorage.setItem('themeVariant', 'dark'));

Now refer this file in config.toml as shown below:

custom_js = "/public/custom.js"

After doing this change when you restart the chainlit app, it will load the dark theme by default :-)

sahajamit avatar Mar 20 '24 16:03 sahajamit