Skip to content

Support built-in color names for the color parameter of charts #12694

@jrieke

Description

@jrieke

Checklist

  • I have searched the existing issues for similar feature requests.
  • I added a descriptive title and summary to this issue.

Summary

Our built-in charts (e.g. st.area_chart, st.line_chart, etc) have a color parameter. But this parameter does not accept the built-in color names we use e.g. for colored Markdown text or st.badge (red, orange, yellow, blue, green, violet, gray/grey, or primary). We should support those as well!

Why?

  • Makes our commands more consistent
  • Makes it easier to pick colors that look good and consistent with the rest of the app.
  • Allows theming these colors.

How?

  • The color parameter for st.area_chart, st.line_chart, st.bar_chart, st.scatter_chart should accept the following colors: red, orange, yellow, blue, green, violet, gray/grey, or primary
  • This should work just like a HEX or RGB string for long and wide formats and for single and multiple series.
  • The charts should use the "main" colors from theming, e.g. theme.redColor if color="red" is set.
  • In the docstring, we should list the built-in color names as the first option and also show them in examples if we add some, so we drive users towards using these nice and simple colors instead of having to find their own custom colors.

Additional Context

Related:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions