Skip to content

Add theme background color config options#12405

Merged
mayagbarnes merged 10 commits intodevelopfrom
config-bg-colors
Sep 4, 2025
Merged

Add theme background color config options#12405
mayagbarnes merged 10 commits intodevelopfrom
config-bg-colors

Conversation

@mayagbarnes
Copy link
Copy Markdown
Collaborator

@mayagbarnes mayagbarnes commented Sep 2, 2025

Describe your changes

Add configurable background colors for theming:

  • redBackgroundColor
  • orangeBackgroundColor
  • yellowBackgroundColor
  • blueBackgroundColor
  • greenBackgroundColor
  • violetBackgroundColor
  • grayBackgroundColor

Order of precedence:

  • Uses configured redBackgroundColor
  • If there is no configured redBackgroundColor, derives it from a provided redColor (uses 10% opacity for light theme and 20% opacity for dark theme)
  • If neither, falls back to default

Testing Plan

  • Unit Tests (JS and/or Python): ✅
  • E2E Tests: ✅ Added / snaps updated
  • Manual Testing: ✅

@mayagbarnes mayagbarnes added security-assessment-completed change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Sep 2, 2025
@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Sep 2, 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 Sep 2, 2025

✅ PR preview is ready!

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

@mayagbarnes mayagbarnes requested a review from Copilot September 3, 2025 03:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds configurable background colors for theming with support for seven color categories (red, orange, yellow, blue, green, violet, gray) that can be used throughout the application. The background colors follow a three-tier fallback system: explicit background color configuration takes priority, followed by deriving from main color configuration with appropriate opacity, and finally falling back to default values.

Key Changes

  • Added seven new background color configuration options for both main theme and sidebar theme
  • Implemented smart fallback logic that derives background colors from main colors when explicit background colors aren't provided
  • Added comprehensive test coverage for the new functionality

Reviewed Changes

Copilot reviewed 10 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
proto/streamlit/proto/NewSession.proto Adds protobuf definitions for the seven new background color fields
lib/streamlit/config.py Adds configuration options with detailed documentation for all background colors
lib/tests/streamlit/runtime/app_session_test.py Updates test mocks and assertions to include new background color configurations
lib/tests/streamlit/proto_compatibility_test.py Adds protobuf field definitions to compatibility tests
lib/tests/streamlit/config_test.py Adds comprehensive config option testing for background colors
frontend/lib/src/theme/utils.ts Implements background color resolution logic with fallback hierarchy
frontend/lib/src/theme/utils.test.ts Adds extensive unit tests for background color functionality
e2e_playwright/theming/custom_main_colors_test.py Updates test configuration to demonstrate derived background colors
e2e_playwright/theming/custom_background_colors_test.py Adds new E2E test for explicit background color configuration
e2e_playwright/theming/custom_background_colors.py Creates test app showcasing background color usage across UI elements

@mayagbarnes mayagbarnes marked this pull request as ready for review September 3, 2025 13:46
@mayagbarnes mayagbarnes requested a review from a team as a code owner September 3, 2025 13:46
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 19a5baf into develop Sep 4, 2025
37 checks passed
@mayagbarnes mayagbarnes deleted the config-bg-colors branch September 4, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants