Skip to content

Commit e73e8ad

Browse files
Merge pull request #35 from AriyanPal08/feature/darkmode
Add: dark mode toggle
2 parents be07f90 + 7f5a3dd commit e73e8ad

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
1.4 KB
Binary file not shown.

app.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,29 @@
55

66
# Load a pre-trained Hugging Face model
77
##chatbot = pipeline("text-generation", model='distilgpt2')
8+
# 🌙 Dark Mode Toggle Setup
9+
if "dark_mode" not in st.session_state:
10+
st.session_state.dark_mode = False
11+
12+
# Sidebar toggle
13+
st.sidebar.title("🛠 Settings")
14+
st.session_state.dark_mode = st.sidebar.checkbox("🌙 Enable Dark Mode", value=st.session_state.dark_mode)
15+
16+
# Inject CSS based on toggle
17+
if st.session_state.dark_mode:
18+
st.markdown("""
19+
<style>
20+
body, .main { background-color: #121212; color: #e0e0e0; }
21+
.stButton>button { background-color: #333; color: white; }
22+
.stTextInput>div>div>input { background-color: #1e1e1e; color: white; }
23+
</style>
24+
""", unsafe_allow_html=True)
25+
else:
26+
st.markdown("""
27+
<style>
28+
body, .main { background-color: #ffffff; color: #000000; }
29+
</style>
30+
""", unsafe_allow_html=True)
831

932
# Health Information Library
1033
health_info = {

0 commit comments

Comments
 (0)