Version 1.16.0

Highlights

  • :woman_artist: Introducing a new Streamlit theme for Altair, Plotly, and Vega-Lite charts! Check out our blog post for more information.
  • :art: Streamlit now supports colored text in all commands that accept Markdown, including st.markdown, st.header, and more. Learn more in our documentation.

Notable Changes

  • :repeat: Functions cached with st.experimental_memo or st.experimental_singleton can contain Streamlit media elements and forms.
  • :snowman: All Streamlit commands that accept pandas DataFrames as input also support Snowpark and PySpark DataFrames.
  • :label: st.checkbox and st.metric can customize how to hide their labels with the label_visibility parameter.

Other Changes

  • :world_map: st.map improvements: support for upper case columns and better exception messages (#5679, #5792).
  • :lady_beetle: Bug fix: st.plotly_chart respects the figure’s height attribute and the use_container_width parameter (#5779).
  • :beetle: Bug fix: all commands with the icon parameter such as st.error, st.warning, etc, can contain emojis with variant selectors (#5583).
  • :honeybee: Bug fix: prevent st.camera_input from jittering when resizing the browser window (#5661).
  • :ant: Bug fix: update exception layout to avoid overflow of stack traces (#5700).
8 Likes

I was hoping for a much more expansive list of supported colors:

blue, green, orange, red, violet.

I can see plenty of reasons why you would want to KISS on this feature, but for someone like me who is strongly interested in colors as an aspect of design, this is a painfully limited palette. My publishing company has its own custom colors that it uses wherever possible. I’d like to be able to choose from a roster of websafe colors (imagemagick has ~500 IIRC) or, even better, to define my own colors (“Nimble Blue”, which I use for most of my book covers, is 0,0,102…).

As a compromise can I suggest opening up an experimental or even undocumented feature that allows defining, importing, and saving sets of colors. I realize that you would want to provide some pretty sturdy disclaimers about the havoc a poorly chosen text color can wreak on readability!

Hey @fredzannarbor, thanks for the feedback! 100% understand that this is limiting for design-savvy people :wink: It’s a first version, and we’ll definitely do improvements in the future.

Now, as you already said, supporting completely arbitrary colors is a tricky thing. It’s cool for people like you but can lead to really bad apps for people who are not very familiar with design. We plan to do a bigger project next year to look into how we can support such visual customizations in a more general way where people don’t shoot themselves in the foot.

For now, you can always use HTML to hack arbitrary colors:

st.markdown(
    "This is <span style='color: #123456'>an arbitrary color</span>", 
    unsafe_allow_html=True
)
1 Like

@fredzannarbor since we are kicking off a bigger project to expand what you can do design wise - do you have other ideas on features you’d love to see? Also would love to know more about the apps that you’re creating and why visual customization is important to you!

3 Likes

Any chance that access to adding css classes/ids is included in that project? GitHub FR

One of my pain points is control over how columns flex. This includes not being able to put columns inside columns as well as being forced into “all or one”. It would be nice to have the option to control how things flex, preferring a progressive reduction: fives columns, four columns, three columns, …as you reduce the width. For this I would almost imagine a different element than columns as the use case typically involves me iterating through a list to distribute elements to the columns. Perhaps an st.flex_grid element to which we can pass a list of objects would be good?

feature idea:
I’m not sure if I will use the colored texts, but if I do I would like to have access to the colors from the Theme settings. (I realize that only the Primary color makes sense).

st.markdown(”This text is :themed[colored primary_color].”)

that would keep the app consistent when playing arround with the themes as there are no “fixed” colors that clash with e.g. a dark theme.

maybe an additional “highlighting color” in the theme would make sense.

Why customisation is important? (for me)

  • when writing apps for different colleagues , all in the same field, all with streamlit they can look quite simmilar. After some time even the names can get quite simmilar. Therefore I like to give them different icons/emojis and change the theme-colors to distinguish them at a glance.
  • using company colors from corporate designs when a project has matured is always a plus when showing apps to managment/superiors.
2 Likes

Hi @snehankekre, almost all data widgets support coloured text in this Streamlit version. I think Checkbox got left out. Hope this is added in the next version.

Thanks in advance.

Cheers

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.