Skip to content

Add codeTextColor config & update linkColor #12562

Merged
mayagbarnes merged 5 commits intodevelopfrom
code-text-config
Sep 19, 2025
Merged

Add codeTextColor config & update linkColor #12562
mayagbarnes merged 5 commits intodevelopfrom
code-text-config

Conversation

@mayagbarnes
Copy link
Copy Markdown
Collaborator

@mayagbarnes mayagbarnes commented Sep 17, 2025

Describe your changes

PR does the following:

  • Add new codeTextColor config for theme & theme.sidebar
  • Refactor link color handling so fallback is blueTextColor (config/derived/default)
  • Removed unnecessary ExtendedCustomThemeConfig type

Code text color will be determined in the following order:

  • codeTextColor config
  • greenTextColor config
  • derived greenTextColor (from greenColor config)
  • default greenTextColor (streamlit theme)

Link text color will be determined in the following order:

  • linkColor config
  • blueTextColor config
  • derived blueTextColor (from blueColor config)
  • default blueTextColor (streamlit theme)

GitHub Issue Link (if applicable)

Closes #12426

Testing Plan

  • Unit Tests (JS and/or Python): ✅ Added
  • E2E Tests: ✅ Added
  • 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 17, 2025
@snyk-io
Copy link
Copy Markdown
Contributor

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

✅ PR preview is ready!

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

@mayagbarnes mayagbarnes marked this pull request as ready for review September 18, 2025 16:02
@mayagbarnes mayagbarnes requested a review from a team as a code owner September 18, 2025 16:02
@mayagbarnes mayagbarnes requested a review from Copilot September 18, 2025 16:02
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 a new codeTextColor configuration option for customizing code text color in Streamlit themes, while refactoring the existing linkColor handling to use better fallback logic.

  • Adds codeTextColor config option for both main theme and sidebar
  • Refactors linkColor to fallback to blueTextColor instead of default theme colors
  • Removes unnecessary ExtendedCustomThemeConfig type in favor of Partial<ICustomThemeConfig>

Reviewed Changes

Copilot reviewed 10 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
proto/streamlit/proto/NewSession.proto Adds code_text_color field to protobuf definition
lib/streamlit/config.py Defines new codeTextColor theme configuration option
frontend/lib/src/theme/utils.ts Implements fallback logic for both codeTextColor and linkColor
frontend/lib/src/theme/utils.test.ts Adds comprehensive tests for new color handling logic
lib/tests/streamlit/runtime/app_session_test.py Updates test mocks to include new color configuration
lib/tests/streamlit/config_test.py Updates config tests to validate new theme option
lib/tests/streamlit/proto_compatibility_test.py Adds protobuf compatibility test for new field
e2e_playwright/theming/theme_tester_app.py Updates test app to show code text styling
e2e_playwright/theming/custom_theme_test.py Configures custom theme tests with new color option
e2e_playwright/theming/sidebar_custom_theme_test.py Configures sidebar theme tests with new color option

Comment on lines -57 to -65
// Extended theme config type to include properties not in the protobuf definition
export type ExtendedCustomThemeConfig = Partial<ICustomThemeConfig> & {
baseFontWeight?: number | null
codeFontSize?: string | number | null
codeFontWeight?: number | null
linkUnderline?: boolean | null
chartCategoricalColors?: string[] | null
}

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.

Not sure why this was added, but don't think it should exist so removing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question: is this a regression on the sidebar it looks like the green text no longer wraps?

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.

I manually tested and the inline code is wrapping as expected - think its just because of the font choice/spacing

Copy link
Copy Markdown
Contributor

@sfc-gh-nbellante sfc-gh-nbellante 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 b3a1e33 into develop Sep 19, 2025
38 checks passed
@mayagbarnes mayagbarnes deleted the code-text-config branch September 19, 2025 19:35
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.

Add theming config option for code text color

3 participants