Add support for source directly in theming font configs#12239
Merged
mayagbarnes merged 10 commits intodevelopfrom Aug 25, 2025
Merged
Add support for source directly in theming font configs#12239mayagbarnes merged 10 commits intodevelopfrom
mayagbarnes merged 10 commits intodevelopfrom
Conversation
Contributor
🎉 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) |
Contributor
✅ PR preview is ready!
|
7ccf9dc to
48b4e65
Compare
lukasmasuch
reviewed
Aug 18, 2025
48b4e65 to
430c8e6
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for specifying font sources directly in Streamlit's theming configuration, allowing users to load fonts from external sources like Google Fonts and Adobe Fonts. The implementation uses a new format <font_family_name>:<source_url> for font configuration options.
Key changes:
- Adds a new
FontSourceprotobuf message to store font source URLs alongside configuration names - Implements parsing logic to extract font names and source URLs from theme configuration
- Integrates
react-helmet-asyncto dynamically inject font source<link>tags into the document head
Reviewed Changes
Copilot reviewed 17 out of 21 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| proto/streamlit/proto/NewSession.proto | Adds FontSource message and font_sources field to CustomThemeConfig |
| lib/streamlit/runtime/theme_util.py | New utility module for parsing font configurations with source URLs |
| lib/streamlit/runtime/app_session.py | Updates theme population to use the new font parsing utility |
| frontend/app/src/util/useThemeManager.ts | Extends theme manager to handle font sources and returns them as state |
| frontend/app/src/components/FontSources/ | New component to render font source link tags using react-helmet-async |
| frontend/app/src/ThemedApp.tsx | Integrates FontSources component into the app structure |
| frontend/app/package.json | Adds react-helmet-async dependencies |
| Various test files | Comprehensive test coverage for the new functionality |
sfc-gh-bnisco
approved these changes
Aug 25, 2025
lukasmasuch
reviewed
Aug 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
Allow theming font configs:
font,codeFont&headingFontto accept both a font family name and an optional source url to support sourcing from Google Fonts, Adobe Fonts, etc.Note the format is
<font_family_name_here>:<font_source_url_here>Testing Plan