Add codeTextColor config & update linkColor #12562
Conversation
🎉 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) |
✅ PR preview is ready!
|
There was a problem hiding this comment.
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
codeTextColorconfig option for both main theme and sidebar - Refactors
linkColorto fallback toblueTextColorinstead of default theme colors - Removes unnecessary
ExtendedCustomThemeConfigtype in favor ofPartial<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 |
| // 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 | ||
| } | ||
|
|
There was a problem hiding this comment.
Not sure why this was added, but don't think it should exist so removing.
There was a problem hiding this comment.
question: is this a regression on the sidebar it looks like the green text no longer wraps?
There was a problem hiding this comment.
I manually tested and the inline code is wrapping as expected - think its just because of the font choice/spacing
Describe your changes
PR does the following:
codeTextColorconfig fortheme&theme.sidebarlinkcolor handling so fallback isblueTextColor(config/derived/default)ExtendedCustomThemeConfigtypeCode text color will be determined in the following order:
codeTextColorconfiggreenTextColorconfiggreenTextColor(fromgreenColorconfig)greenTextColor(streamlit theme)Link text color will be determined in the following order:
linkColorconfigblueTextColorconfigblueTextColor(fromblueColorconfig)blueTextColor(streamlit theme)GitHub Issue Link (if applicable)
Closes #12426
Testing Plan