Skip to content

Add default main colors to theme#12334

Merged
mayagbarnes merged 11 commits intodevelopfrom
default-main-colors
Aug 27, 2025
Merged

Add default main colors to theme#12334
mayagbarnes merged 11 commits intodevelopfrom
default-main-colors

Conversation

@mayagbarnes
Copy link
Copy Markdown
Collaborator

@mayagbarnes mayagbarnes commented Aug 26, 2025

Describe your changes

Add the following main color keys, with defaults for streamlit light/dark themes:

  • redColor
  • orangeColor
  • yellowColor
  • blueColor
  • greenColor
  • violetColor
  • grayColor

Main colors apply to header dividers, st.metric red/green/gray sparklines (line chart, line in area chart, bar chart) and chat message avatars (red/orange) for now - thus the snapshot updates in those categories. This sets the stage for configurable main colors (custom theming).

Testing Plan

  • JS Unit Tests: ✅
  • E2E Tests: ✅ Snaps updated
  • Manual Testing: ✅

@mayagbarnes mayagbarnes added security-assessment-completed change:refactor PR contains code refactoring without behavior change impact:users PR changes affect end users labels Aug 26, 2025
@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Aug 26, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 26, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12334/streamlit-1.48.1-py3-none-any.whl
🕹️ Preview app pr-12334.streamlit.app (☁️ Deploy here if not accessible)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will revisit when we handle background colors since grayColor is too light for light theme here 😞
Screenshot 2025-08-26 at 5 42 14 p m

Screenshot 2025-08-26 at 5 42 30 p m

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean the delta text? These should use the text colors (e.g. grayTextColor), not the main colors.

Copy link
Copy Markdown
Collaborator Author

@mayagbarnes mayagbarnes Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I mean the grayColor - you don't think the line itself in the sparkline is too light? (Understand the confusion since one function currently controls both the delta text and the sparkline chart main color - so they use same color - will decouple/fix that when I get to text colors)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the same feeling in the chart column color PR here that the grey chart feels a bit too light:

image

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And is the delta badge for light green the same as the combination of colors we use for the green badge (green background + green text)? This one also looks missing a bit of contrast.

Copy link
Copy Markdown
Collaborator

@lukasmasuch lukasmasuch Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we might want to refactor the metric component to use the green text color for the green text, the background color for the delta background and the main green color for the chart (instead of having a single metric positive / negative color)?

Copy link
Copy Markdown
Contributor

@sfc-gh-jrieke sfc-gh-jrieke Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aah got it. So:

  1. For the gray main/line color, I agree it's a bit too light. I changed it to gray60 in the figma now, I think that's a good compromise, and grayBackground allso uses that with 10% transparency (just like all the other background colors use the main color with 10% transparency). The nice thing about this is also that gray background then almost matches the background we have for st.code etc.
  2. Yes, agree we need to refactor this so we're using text colors for the delta text, background colors for the delta background + area chart area, and main colors for the line chart, bar chart, and the line of the area chart.

@mayagbarnes mayagbarnes marked this pull request as ready for review August 27, 2025 02:53
Copy link
Copy Markdown
Collaborator

@lukasmasuch lukasmasuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@mayagbarnes mayagbarnes merged commit d6eb629 into develop Aug 27, 2025
36 checks passed
@mayagbarnes mayagbarnes deleted the default-main-colors branch August 27, 2025 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:refactor PR contains code refactoring without behavior change impact:users PR changes affect end users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants