Add theming support to new visual designer#18987
Merged
Conversation
Contributor
|
Test this change out locally with the following install scripts (Action run 21884519724) VSCode
Azure CLI
|
majastrz
approved these changes
Feb 10, 2026
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.
Summary
Add VS Code theme support to the new visual designer so it renders correctly in light, dark, high-contrast dark, and high-contrast light themes.
Changes
New files
styled.d.ts—DefaultThemetype augmentation for styled-components, declaring the shape of the theme object (canvas, node, text, edge, controlBar, etc.)theming/themes.ts— Four curated color palettes (lightTheme,darkTheme,highContrastTheme,highContrastLightTheme) plusgetThemeFromBody()which readsdocument.body.dataset.vscodeThemeKindtheming/useTheme.ts— React hook that observesdata-vscode-theme-kindon<body>viaMutationObserverand returns the matchingDefaultThemeUpdated files
App.tsx— Wraps component tree in styled-components<ThemeProvider>; renders<GlobalStyle />inside the providerGlobalStyle.ts— Uses theme props forbackground-colorandcolorCanvasBackground.tsx— UsescurrentColortrick withuseTheme()for dot grid color; transparent dots in HC themesResourceDeclaration.tsx/ModuleDeclaration.tsx— Styled-component theme interpolations for node border, background, text colorsEdgeMarkerDefs.tsx/StraightEdge.tsx—useTheme()for edge stroke color as JSX propsGraphControlBar.tsx— Theme interpolations for toolbar background, border, icon, hover/active/focus statesCanvas.tsx— Builds grab cursor data URI from theme props (grabCursor.fill/grabCursor.opacity)index.tsx— Cleaned up (theming is handled entirely inApp.tsx)Documentation
visualizer-migration/step-2-theming.md— Updated to reflect the actual implementationvisualizer-migration/README.md— Step 2 marked as completeDesign decisions
--vscode-*variables — Editor theme colors are designed for text editors, not graph visualization. Curated palettes ensure nodes, edges, and canvas look intentional.data-vscode-theme-kindoverclassName— The body class list can contain multiple overlapping theme classes (e.g.vscode-high-contrast-light vscode-high-contrast vscode-reduce-motion), making regex matching unreliable. The data attribute always has a single, unambiguous value.Testing
Verified with
npm run devusing the<vscode-dev-toolbar>to toggle between all four themes. Build passes (npx turbo build).Microsoft Reviewers: Open in CodeFlow