Skip to content

Support configuring the chart column colors#12292

Merged
lukasmasuch merged 14 commits intodevelopfrom
feature/chart-column-colors
Sep 17, 2025
Merged

Support configuring the chart column colors#12292
lukasmasuch merged 14 commits intodevelopfrom
feature/chart-column-colors

Conversation

@lukasmasuch
Copy link
Copy Markdown
Collaborator

@lukasmasuch lukasmasuch commented Aug 22, 2025

Describe your changes

Adds support for configuring the colors of charts in LineChartColumn, AreaChartColumn, BarChartColumn.

image

GitHub Issue Link (if applicable)

Testing Plan

  • Added unit & e2e tests.

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Aug 22, 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 22, 2025

✅ PR preview is ready!

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

@lukasmasuch lukasmasuch changed the title [WIP] Support changing the chart column colors [WIP] Support configuring the chart column colors Aug 22, 2025
@lukasmasuch lukasmasuch changed the title [WIP] Support configuring the chart column colors Support configuring the chart column colors Sep 9, 2025
@lukasmasuch lukasmasuch added security-assessment-completed change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Sep 9, 2025
@lukasmasuch lukasmasuch requested a review from Copilot September 9, 2025 14:01
@lukasmasuch lukasmasuch marked this pull request as ready for review September 9, 2025 14:01
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

This PR adds support for configuring chart column colors in LineChartColumn, AreaChartColumn, and BarChartColumn components. The enhancement allows users to specify custom colors, theme colors, or automatic color selection based on data trends.

Key Changes

  • Added color parameter to chart column configuration functions in Python backend
  • Implemented color mapping and trend-based coloring logic in TypeScript frontend
  • Added comprehensive unit and E2E tests for the new color functionality

Reviewed Changes

Copilot reviewed 5 out of 32 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lib/streamlit/elements/lib/column_types.py Adds ChartColor type alias and color parameters to chart column configurations
frontend/lib/src/components/widgets/DataFrame/columns/ChartColumn.ts Implements color mapping, theme integration, and trend-based coloring logic
frontend/lib/src/components/widgets/DataFrame/columns/ChartColumn.test.ts Adds unit tests for color functionality including theme mapping and auto coloring
e2e_playwright/st_dataframe_config_test.py Updates test indices and adds chart colors test coverage
e2e_playwright/st_dataframe_config.py Adds E2E test cases demonstrating various color configurations

lukasmasuch and others added 2 commits September 9, 2025 16:05
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Comment on lines +1150 to +1160
color: "auto", "auto-inverse", or str or None
The color to use for the chart. Can be one of the following:

- ``None`` (default): The primary color will be used.
- ``"auto"``: To color the chart green if the data is increasing, and
red if the data is decreasing.
- ``"auto-inverse"``: To color the chart red if the data is increasing, and
green if the data is decreasing.
- A single color value that is applied to all charts in the column. This supports either
a hex code, e.g. ``"#000000"``, or one of the following supported theme colors:
blue, green, orange, red, violet, yellow, gray/grey, or primary.
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.

suggestion (non-blocking): Consider adding validation for this argument for better DX.

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.

Added validation 👍

@lukasmasuch lukasmasuch enabled auto-merge (squash) September 17, 2025 21:38
@lukasmasuch lukasmasuch merged commit 5abda77 into develop Sep 17, 2025
38 checks passed
@lukasmasuch lukasmasuch deleted the feature/chart-column-colors branch September 17, 2025 21:44
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.

Allow to customize colors for chart dataframe columns

4 participants