๐ย ย Theme
Submitted by Gabriel Tem Pass
Summary
A component that returns the active theme of the Streamlit app.
Deprecation note: With Streamlit 1.46.0 you can now detect if the viewer is in light mode or dark mode at runtime with st.context.theme.
Docstring
Visit the PyPI page for more information.
Examples
example_1
def example_1():
import streamlit as st
from streamlit_theme import st_theme
theme = st_theme()
st.write(theme)
example_2
def example_2():
import streamlit as st
from streamlit_theme import st_theme
adjust = st.toggle("Make the CSS adjustment")
st.write("Input:")
st.code(
f"""
st.write("Lorem ipsum")
st_theme(adjust={adjust})
st.write("Lorem ipsum")
"""
)
st.write("Output:")
st.write("Lorem ipsum")
st_theme(adjust=adjust)
st.write("Lorem ipsum")