Add size tokens and registry implementation for theme customization#283800
Merged
mrleemurray merged 7 commits intomainfrom Dec 16, 2025
Merged
Add size tokens and registry implementation for theme customization#283800mrleemurray merged 7 commits intomainfrom
mrleemurray merged 7 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new size token registry system for VS Code theme customization, following the same architectural pattern as the existing color registry. It allows size-related properties (font sizes, corner radii, stroke thickness) to be defined centrally and applied consistently across the UI through CSS custom properties.
Key changes:
- New size registry infrastructure with full lifecycle management (register/deregister, schema generation, theme updates)
- Initial set of base size tokens including font sizes, corner radii, and stroke thickness
- Integration with the workbench theme service to generate CSS variables for registered size tokens
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/platform/theme/common/sizeUtils.ts | Core size registry implementation with JSON schema generation, size value types, and CSS variable conversion utilities |
| src/vs/platform/theme/common/sizeRegistry.ts | Barrel export file re-exporting sizeUtils and baseSizes following the pattern used by colorRegistry |
| src/vs/platform/theme/common/sizes/baseSizes.ts | Initial size token definitions including bodyFontSize, codiconFontSize, various cornerRadius scales, and strokeThickness |
| src/vs/platform/theme/test/common/sizeRegistry.test.ts | Unit tests for size registry functionality including registration, CSS conversion, and helper functions |
| src/vs/workbench/services/themes/browser/workbenchThemeService.ts | Integration point that generates CSS variables from registered size tokens alongside existing color variables |
src/vs/workbench/services/themes/browser/workbenchThemeService.ts
Outdated
Show resolved
Hide resolved
aiday-mar
previously approved these changes
Dec 16, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
bpasero
approved these changes
Dec 16, 2025
This was referenced Dec 17, 2025
|
Folks, I may have misinterpreted the changes, but just be sure: I see we now have |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This implementation adds a size registry system to VS Code, similar to the existing color registry. The size registry allows centralized management of size tokens (font sizes, line heights, letter spacing, corner radii, stroke thickness) that are automatically converted to CSS custom properties.
Files Created
Core Implementation
src/vs/platform/theme/common/sizeUtils.tsSizeRegistryclassSizeIdentifier,SizeValue,SizeContribution, etc.)size(),sizeValueToCss(),asCssVariable(),asCssVariableName())src/vs/platform/theme/common/sizeRegistry.tscolorRegistry.ts)sizeUtils.tsand size token definitionssrc/vs/platform/theme/common/sizes/baseSizes.tsfontSize,fontSize.small,fontSize.largelineHeight,lineHeight.compact,lineHeight.relaxedletterSpacing,letterSpacing.widecornerRadius,cornerRadius.small,cornerRadius.largestrokeThickness,strokeThickness.thick,strokeThickness.focusIntegration
src/vs/workbench/services/themes/browser/workbenchThemeService.ts(modified).monaco-workbenchalongside color variablesTests
src/vs/platform/theme/test/common/sizeRegistry.test.tsFeatures Implemented
✅ Size Token Registration
✅ CSS Variable Generation
--vscode-prefixfontSize→--vscode-fontSize: 13px✅ Helper Functions
size(value, unit)- Create size valuessizeForAllThemes(value, unit)- Create same size value for all themessizeValueToCss(sizeValue)- Convert to CSS stringasCssVariable(identifier)- Get CSS variable referenceasCssVariableName(identifier)- Get CSS variable name✅ JSON Schema Integration
✅ Base Size Tokens
Usage
In TypeScript/JavaScript:
In CSS:
Not Implemented (Future Work)
❌ User Overrides
workbench.colorCustomizations❌ Size Transformations
❌ Theme JSON Support
Architecture
The implementation follows the exact same pattern as the color registry: