Support demo users
Some checks failed
Run Tests / run-tests (push) Failing after 1m2s

This commit is contained in:
2026-05-01 17:41:42 +02:00
parent a88d1b4e79
commit 0632899f7a
11 changed files with 169 additions and 134 deletions

View File

@@ -1,28 +1,28 @@
import streamlit as st
from queries import crud
from user import is_logged_in, is_login_enabled
def init_themes():
if 'themes' not in st.session_state:
st.session_state.themes = {
"dark": {
"theme.base": "dark",
"theme.backgroundColor": "black",
"theme.primaryColor": "#c98bdb",
"theme.secondaryBackgroundColor": "#5591f5",
"theme.textColor": "white",
"button_face_label": "Dark",
"button_face_icon": ":material/dark_mode:"
},
"light": {
"theme.base": "light",
"theme.backgroundColor": "white",
"theme.primaryColor": "#5591f5",
"theme.secondaryBackgroundColor": "#82E1D7",
"theme.textColor": "#0a1464",
"button_face_label": "Light",
"button_face_icon": ":material/light_mode:"
},
"dark": {
"theme.base": "dark",
"theme.backgroundColor": "black",
"theme.primaryColor": "#c98bdb",
"theme.textColor": "white",
"button_face_label": "Dark",
"button_face_icon": ":material/dark_mode:"
}
}
if 'current_theme' not in st.session_state:
@@ -30,7 +30,10 @@ def init_themes():
change_theme('light')
def change_theme(theme):
crud.set_theme(theme)
if is_logged_in():
crud.set_theme(theme)
st.session_state.current_theme = theme
for key, val in st.session_state.themes[theme].items():
if key.startswith("theme"):
st._config.set_option(key, val)