prim_color = st.config.get_option('theme.primaryColor') or '#F43365'
bg_color = st.config.get_option('theme.backgroundColor') or '#000000'
sbg_color = st.config.get_option('theme.secondaryBackgroundColor') or '#f1f3f6'
txt_color = st.config.get_option('theme.textColor') or '#000000'
font = st.config.get_option('theme.font') or 'sans serif'
st.config.get… takes colors from the file ‘config.toml’, so if you define colors in config toml, your button will get the same colors as the rest of the layout (there are some differences in streamlit, and for example upload files button have different colors from other buttons)
Ok, but when i do some changes at colors didn’t bring the same expect as i have in streamlit stardand style button (also the border color in grey i think)
My donwload button, as you can see, don’t have the border color…
prim_color = st.config.get_option('theme.primaryColor') or '#F43365'
bg_color = st.config.get_option('theme.backgroundColor') or '#000000'
sbg_color = st.config.get_option('theme.secondaryBackgroundColor') or '#f1f3f6'
txt_color = st.config.get_option('theme.textColor') or '#000000'
font = st.config.get_option('theme.font') or 'sans serif'
is responsible for what. you can only change sets of colors.
primaryColor='#6C9BC0' # radiobuttons etc
backgroundColor="#FFFFFF" # Main color
secondaryBackgroundColor="#d3d4db" # sidebar color
textColor="#262730"
font="sans serif"
@BeyondMyself I tried this but when i press the button to download, and go to excel to open the file, i get a error saying the file are corrupted or are in different extension
and the code @czubert make available, only let the user download the file in csv or txt extension. As shows here:
"""
Generates a link to download the given object_to_download.
Params:
------
object_to_download: The object to be downloaded.
download_filename (str): filename and extension of file. e.g. mydata.csv,
some_txt_output.txt
download_link_text (str): Text to display for download
link.
button_text (str): Text to display on download button (e.g. 'click here to download file')
pickle_it (bool): If True, pickle file.
Returns:
-------
(str): the anchor tag to download object_to_download
Examples:
--------
download_link(your_df, 'YOUR_DF.csv', 'Click to download data!')
download_link(your_str, 'YOUR_STRING.txt', 'Click to download text!')
"""
As you may see in the download_button function, there is an if alse statement if picle_it, inside else statement there is another if else statement in which it checks the distance.
you can see that there is written that if instance is pd.DataFrame, then you should use method ‘to_csv’
you need to change it to: pd.dataframe.to_excel() for more info check it here:pandas.DataFrame.to_excel — pandas 1.2.4 documentation
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.