Untitled conversation
- User
[theme] primaryColor="#5d3aa0" backgroundColor="#fdfcfc" secondaryBackgroundColor="#d8e4fb" textColor="#0d1a62" how to inetgatret this theme To save your changes, copy your custom theme into the clipboard and paste it into the[theme] section of your .streamlit/config.toml file.
- Assistant
To integrate your custom theme into your Streamlit app, follow these steps:
-
Locate the Configuration File: First, make sure you have a
.streamlitdirectory in your project folder. If it doesn't exist, you can create it. -
Create or Edit the
config.tomlFile: Inside the.streamlitdirectory, you should have a file namedconfig.toml. If it's not there, create a new file with that name. -
Add Your Custom Theme: Open the
config.tomlfile in a text editor and add your custom theme to the[theme]section. If the[theme]section already exists, replace its contents with your new theme settings. If it does not exist, you can create it. Here’s how it should look:[theme] primaryColor="#5d3aa0" backgroundColor="#fdfcfc" secondaryBackgroundColor="#d8e4fb" textColor="#0d1a62" -
Save the Changes: After editing the
config.tomlfile, save it. -
Run Your Streamlit App: Now, when you run your Streamlit application, it should use the custom theme you specified in the
config.tomlfile.
Example Structure
Your project directory should look something like this:
your_project/ │ ├── your_streamlit_app.py └── .streamlit/ └── config.tomlAdditional Tips
- If you ever want to modify the theme later, simply reopen the
config.tomlfile and make your changes. - You can also check the official Streamlit documentation on themes for additional options and configurations you can apply to your theme.
-
- User
Sidebar Navigation
st.sidebar.title(" S&A SUBMISSIONS") nav_options = ['Home','ALB Asia IP Rankings', 'http://localhost:8501/', 'Legal Era' , 'IFLR 1000' , 'Legal 500' ] selected_option = st.sidebar.selectbox("Choose an Option", nav_options) in this as i p;aced link i wanted link for all the tabs .....dispaly Chmabers and clciking redirect to http://localhost:8501/ - Assistant
To incorporate links into your Streamlit sidebar navigation effectively, you can use the
st.sidebar.markdownmethod. This allows you to create clickable links alongside your navigation options. Below is an example of how you can implement this with the "Chambers" link that redirects tohttp://localhost:8501/:import streamlit as st # Sidebar Navigation st.sidebar.title("S&A SUBMISSIONS") nav_options = ['Home', 'ALB Asia IP Rankings', 'Legal Era', 'IFLR 1000', 'Legal 500', 'Chambers'] selected_option = st.sidebar.selectbox("Choose an Option", nav_options) # Display selected option if selected_option == 'Home': st.write("Welcome to the Home Page") elif selected_option == 'ALB Asia IP Rankings': st.write("Displaying ALB Asia IP Rankings...") elif selected_option == 'Legal Era': st.write("Displaying Legal Era...") elif selected_option == 'IFLR 1000': st.write("Displaying IFLR 1000...") elif selected_option == 'Legal 500': st.write("Displaying Legal 500...") elif selected_option == 'Chambers': st.sidebar.markdown("[Click here to go to Chambers](http://localhost:8501/)", unsafe_allow_html=True) st.write("You can explore Chambers by clicking the link in the sidebar.")Explanation:
-
Sidebar Setup: The sidebar contains a title and a select box with the different navigation options, including "Chambers".
-
Dynamic Content: Depending on the selected option, specific content will be displayed on the main page.
-
Clickable Link: For the "Chambers" option, a markdown link is created that provides a clickable redirect. The
unsafe_allow_html=Trueargument is used to allow HTML rendering.
Note:
- When using
unsafe_allow_html=True, it’s important to ensure that the HTML content being rendered does not pose any security risks. - If "Chambers" should navigate away from the current Streamlit app, you might want to consider using
st.experimental_set_query_paramsor using the HTML redirect. However, note that seamless navigation won't happen within a typical Streamlit application, as closing the Streamlit app would normally redirect to the link instead of opening in the same session.
-