Spaces:
Runtime error
Runtime error
Refactoring
Browse files
app.py
CHANGED
@@ -1,17 +1,33 @@
|
|
1 |
import re
|
|
|
2 |
|
3 |
import streamlit as st
|
4 |
|
5 |
import fragments
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
if 'primaryColor' not in st.session_state:
|
8 |
-
st.session_state['primaryColor'] = st._config.get_option(f'theme.primaryColor') or
|
9 |
if 'backgroundColor' not in st.session_state:
|
10 |
-
st.session_state['backgroundColor'] = st._config.get_option(f'theme.backgroundColor') or
|
11 |
if 'secondaryBackgroundColor' not in st.session_state:
|
12 |
-
st.session_state['secondaryBackgroundColor'] = st._config.get_option(f'theme.secondaryBackgroundColor') or
|
13 |
if 'textColor' not in st.session_state:
|
14 |
-
st.session_state['textColor'] = st._config.get_option(f'theme.textColor') or
|
15 |
|
16 |
|
17 |
primary_color = st.color_picker('Primary color', key="primaryColor")
|
|
|
1 |
import re
|
2 |
+
from typing import NamedTuple
|
3 |
|
4 |
import streamlit as st
|
5 |
|
6 |
import fragments
|
7 |
|
8 |
+
class ThemeColor(NamedTuple):
|
9 |
+
primaryColor: str
|
10 |
+
backgroundColor: str
|
11 |
+
secondaryBackgroundColor: str
|
12 |
+
textColor: str
|
13 |
+
|
14 |
+
|
15 |
+
default_color = ThemeColor(
|
16 |
+
primaryColor="#ff4b4b",
|
17 |
+
backgroundColor="#ffffff",
|
18 |
+
secondaryBackgroundColor="#f0f2f6",
|
19 |
+
textColor="#31333F",
|
20 |
+
)
|
21 |
+
|
22 |
+
|
23 |
if 'primaryColor' not in st.session_state:
|
24 |
+
st.session_state['primaryColor'] = st._config.get_option(f'theme.primaryColor') or default_color.primaryColor
|
25 |
if 'backgroundColor' not in st.session_state:
|
26 |
+
st.session_state['backgroundColor'] = st._config.get_option(f'theme.backgroundColor') or default_color.backgroundColor
|
27 |
if 'secondaryBackgroundColor' not in st.session_state:
|
28 |
+
st.session_state['secondaryBackgroundColor'] = st._config.get_option(f'theme.secondaryBackgroundColor') or default_color.secondaryBackgroundColor
|
29 |
if 'textColor' not in st.session_state:
|
30 |
+
st.session_state['textColor'] = st._config.get_option(f'theme.textColor') or default_color.textColor
|
31 |
|
32 |
|
33 |
primary_color = st.color_picker('Primary color', key="primaryColor")
|