Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Home.py #74

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions Home.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import streamlit as st

st.set_page_config(page_title="College.ai", page_icon='src/Logo College.png', layout='centered', initial_sidebar_state="auto")

# Load CSS file
st.markdown('<style>' + open('./src/style.css').read() + '</style>', unsafe_allow_html=True)

from streamlit_lottie import st_lottie
Expand All @@ -18,8 +20,6 @@
# Initialize session state for theme
if "current_theme" not in st.session_state:
st.session_state.current_theme = "light"
if "theme_changed" not in st.session_state:
st.session_state.theme_changed = False

themes = {
"light": {
Expand All @@ -35,7 +35,7 @@
"theme.backgroundColor": "white",
"theme.primaryColor": "#c19ad9",
"theme.secondaryBackgroundColor": "#c98bdb",
"theme.textColor": "#black",
"theme.textColor": "black",
"button_face": "🌞"
}
}
Expand All @@ -45,19 +45,16 @@ def change_theme():
current_theme = st.session_state.current_theme
new_theme = "dark" if current_theme == "light" else "light"
st.session_state.current_theme = new_theme
st.session_state.theme_changed = True

# Display theme change button
btn_face = themes[st.session_state.current_theme]["button_face"]
if st.button(btn_face, on_click=change_theme):
pass

# Apply theme changes if theme has changed
if st.session_state.theme_changed:
tdict = themes[st.session_state.current_theme]
for key, value in tdict.items():
st._config.set_option(key, value)
st.session_state.theme_changed = False
# Apply theme changes
tdict = themes[st.session_state.current_theme]
for key, value in tdict.items():
st._config.set_option(key, value)

# Home Page Function
def home():
Expand Down