-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvscode-plugin.js
More file actions
175 lines (152 loc) · 5.36 KB
/
Copy pathvscode-plugin.js
File metadata and controls
175 lines (152 loc) · 5.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
const plugin = require('tailwindcss/plugin');
/**
* Tailwind plugin for VSCode-specific utility classes
* Provides direct access to VSCode CSS variables through utility classes
*/
module.exports = plugin(function ({ addUtilities, theme }) {
// VSCode color mappings for common use cases
const vscodeColors = {
// Editor colors
'editor-bg': 'var(--vscode-editor-background)',
'editor-fg': 'var(--vscode-editor-foreground)',
'editor-selection-bg': 'var(--vscode-editor-selectionBackground)',
// Button colors
'button-bg': 'var(--vscode-button-background)',
'button-fg': 'var(--vscode-button-foreground)',
'button-hover-bg': 'var(--vscode-button-hoverBackground)',
'button-secondary-bg': 'var(--vscode-button-secondaryBackground)',
'button-secondary-fg': 'var(--vscode-button-secondaryForeground)',
// Input colors
'input-bg': 'var(--vscode-input-background)',
'input-fg': 'var(--vscode-input-foreground)',
'input-border': 'var(--vscode-input-border)',
'input-placeholder': 'var(--vscode-input-placeholderForeground)',
// Dropdown colors
'dropdown-bg': 'var(--vscode-dropdown-background)',
'dropdown-fg': 'var(--vscode-dropdown-foreground)',
'dropdown-border': 'var(--vscode-dropdown-border)',
// List colors
'list-bg': 'var(--vscode-list-background)',
'list-active-bg': 'var(--vscode-list-activeSelectionBackground)',
'list-active-fg': 'var(--vscode-list-activeSelectionForeground)',
'list-hover-bg': 'var(--vscode-list-hoverBackground)',
'list-hover-fg': 'var(--vscode-list-hoverForeground)',
// Panel colors
'panel-bg': 'var(--vscode-panel-background)',
'panel-border': 'var(--vscode-panel-border)',
// Badge colors
'badge-bg': 'var(--vscode-badge-background)',
'badge-fg': 'var(--vscode-badge-foreground)',
// Status colors
error: 'var(--vscode-errorForeground)',
warning: 'var(--vscode-editorWarning-foreground)',
info: 'var(--vscode-editorInfo-foreground)',
success: 'var(--vscode-terminal-ansiGreen)',
// Focus colors
'focus-border': 'var(--vscode-focusBorder)',
// Text colors
'text-link': 'var(--vscode-textLink-foreground)',
'text-link-active': 'var(--vscode-textLink-activeForeground)',
'text-secondary': 'var(--vscode-descriptionForeground)',
// Scrollbar colors
scrollbar: 'var(--vscode-scrollbar-shadow)',
'scrollbar-thumb': 'var(--vscode-scrollbarSlider-background)',
'scrollbar-thumb-hover': 'var(--vscode-scrollbarSlider-hoverBackground)',
'scrollbar-thumb-active': 'var(--vscode-scrollbarSlider-activeBackground)',
};
const utilities = {};
// Generate utility classes for each VSCode color
Object.entries(vscodeColors).forEach(([key, value]) => {
// Background utilities
utilities[`.bg-vscode-${key}`] = {
backgroundColor: value,
};
// Text color utilities
utilities[`.text-vscode-${key}`] = {
color: value,
};
// Border color utilities
utilities[`.border-vscode-${key}`] = {
borderColor: value,
};
// Ring color utilities (for focus states)
utilities[`.ring-vscode-${key}`] = {
'--tw-ring-color': value,
};
// Outline color utilities
utilities[`.outline-vscode-${key}`] = {
outlineColor: value,
};
});
// Add hover variants
Object.entries(vscodeColors).forEach(([key, value]) => {
utilities[`.hover\\:bg-vscode-${key}:hover`] = {
backgroundColor: value,
};
utilities[`.hover\\:text-vscode-${key}:hover`] = {
color: value,
};
utilities[`.hover\\:border-vscode-${key}:hover`] = {
borderColor: value,
};
});
// Add focus variants
Object.entries(vscodeColors).forEach(([key, value]) => {
utilities[`.focus\\:bg-vscode-${key}:focus`] = {
backgroundColor: value,
};
utilities[`.focus\\:text-vscode-${key}:focus`] = {
color: value,
};
utilities[`.focus\\:border-vscode-${key}:focus`] = {
borderColor: value,
};
utilities[`.focus\\:ring-vscode-${key}:focus`] = {
'--tw-ring-color': value,
};
});
// Add group-hover variants for nested elements
Object.entries(vscodeColors).forEach(([key, value]) => {
utilities[`.group:hover .group-hover\\:bg-vscode-${key}`] = {
backgroundColor: value,
};
utilities[`.group:hover .group-hover\\:text-vscode-${key}`] = {
color: value,
};
});
// Add VSCode-specific scrollbar utilities
utilities['.scrollbar-vscode'] = {
'&::-webkit-scrollbar': {
width: '14px',
height: '14px',
},
'&::-webkit-scrollbar-track': {
backgroundColor: 'transparent',
},
'&::-webkit-scrollbar-thumb': {
backgroundColor: 'var(--vscode-scrollbarSlider-background)',
borderRadius: '0',
},
'&::-webkit-scrollbar-thumb:hover': {
backgroundColor: 'var(--vscode-scrollbarSlider-hoverBackground)',
},
'&::-webkit-scrollbar-thumb:active': {
backgroundColor: 'var(--vscode-scrollbarSlider-activeBackground)',
},
'&::-webkit-scrollbar-corner': {
backgroundColor: 'transparent',
},
};
// Add VSCode-specific focus ring utility
utilities['.focus-ring-vscode'] = {
'&:focus': {
outline: 'none',
boxShadow: `0 0 0 1px var(--vscode-focusBorder)`,
},
'&:focus-visible': {
outline: 'none',
boxShadow: `0 0 0 1px var(--vscode-focusBorder)`,
},
};
addUtilities(utilities);
});