-
Notifications
You must be signed in to change notification settings - Fork 36k
theme: add activity bar hover color tokens + defaults; wire CSS and add smoke test #276259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
theme: add activity bar hover color tokens + defaults; wire CSS and add smoke test #276259
Conversation
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @bpaseroMatched files:
|
|
@microsoft-github-policy-service agree |
There was a problem hiding this 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 hover color tokens for the Activity Bar to allow themes to customize foreground and background colors when hovering over activity bar items. These tokens are registered, added to initial theme colors, declared in the smoke test, and utilized in CSS with fallback chains.
- Registers four new color tokens:
activityBar.hoverForeground,activityBar.hoverBackground,activityBarTop.hoverForeground, andactivityBarTop.hoverBackground - Updates CSS to use the new hover tokens with appropriate fallback chains
- Adds initial color values for dark and light themes
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/common/theme.ts | Registers four new activity bar hover color tokens |
| src/vs/workbench/services/themes/common/workbenchThemeService.ts | Adds initial hover colors for dark and light themes |
| src/vs/workbench/browser/parts/activitybar/media/activityaction.css | Updates hover styles to use new color tokens with fallback chains |
| build/lib/stylelint/vscode-known-variables.json | Declares new CSS variables for stylelint validation |
| src/vs/workbench/services/themes/test/node/colorRegistrySmoke.test.ts | Adds smoke test to verify the hover tokens are registered |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Summary
Add hover-specific theme tokens for the Activity Bar and wire them into the Activity Bar CSS so hover foreground/background can be customized separately from the normal foreground.
Files changed
src/vs/workbench/common/theme.ts— new color registrations:activityBar.hoverForegroundactivityBar.hoverBackgroundactivityBarTop.hoverForegroundactivityBarTop.hoverBackgroundsrc/vs/workbench/browser/parts/activitybar/media/activityaction.css— split active/focus/hover selectors so hover uses new CSS vars:--vscode-activityBar-hoverForeground--vscode-activityBar-hoverBackground--vscode-activityBarTop-*src/vs/workbench/services/themes/common/workbenchThemeService.ts— add defaults for built-in dark/light theme color maps:activityBar.hoverForeground:#00a0dfactivityBar.hoverBackground:#a4dcf3src/vs/workbench/services/themes/test/node/colorRegistrySmoke.test.ts— new smoke test asserting the four tokens are registered and exported.build/lib/stylelint/vscode-known-variables.json— register new CSS variables for stylelint/hygiene.Motivation
Previously hover used
activityBar.foreground, which could produce unreadable white-on-white combinations for certain custom color sets. These new tokens allow themes and users to set hover-specific colors, e.g.:"workbench.colorCustomizations": {
"activityBar.hoverForeground": "#00a0df",
"activityBar.hoverBackground": "#a4dcf3",
"activityBarTop.hoverForeground": "#00a0df",
"activityBarTop.hoverBackground": "#a4dcf3"
}
Tests & verification
colorRegistrySmoke.test.tsensuring the four color identifiers are exported and equal the expected ids.npm run tsec-compile-check) and test script (./scripts/test.sh) locally — both completed successfully.Notes
build/lib/stylelint/vscode-known-variables.jsonto satisfy stylelint/hygiene.hcDark/hcLightdefaults if desired.'#a4dcf320').