✨ feat(vscode): 预览里代码的上色和卡片种类色跟着当前颜色主题走

This commit is contained in:
cruldra committed 2026-10-13 11:27:24 +11:00
1 parent 19302bbed0
commit dff38ee0c5
26 files changed
+1286 -75

No files matched your search

@@ -156,3 +156,18 @@ describe('标签页切走再切回来,调用树弹框照旧开着', () => {
expect(saved?.callTree).toBeUndefined()
})
})
describe('代码配色跟着当前颜色主题', () => {
it('扩展端发来的配色设成 body 上的变量:词性的 --cr-<词性>,种类的 --cr-kind-<种类>;换了主题再发来就换', async () => {
const style = document.body.style
await load()
await deliver({ type: 'codeColors', roles: { keyword: '#C586C0', function: '#DCDCAA' }, kinds: { loop: 'var(--vscode-editor-foreground)' } } as ExtensionToWebview)
expect(style.getPropertyValue('--cr-keyword')).toBe('#C586C0')
expect(style.getPropertyValue('--cr-function')).toBe('#DCDCAA')
expect(style.getPropertyValue('--cr-kind-loop')).toBe('var(--vscode-editor-foreground)')
await deliver({ type: 'codeColors', roles: { keyword: '#AF00DB', function: '#795E26' }, kinds: { loop: '#AF00DB' } } as ExtensionToWebview)
expect(style.getPropertyValue('--cr-keyword')).toBe('#AF00DB')
expect(style.getPropertyValue('--cr-kind-loop')).toBe('#AF00DB')
})
})