forked from winfunc/opcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclaudeSyntaxTheme.ts
More file actions
258 lines (254 loc) · 5.79 KB
/
claudeSyntaxTheme.ts
File metadata and controls
258 lines (254 loc) · 5.79 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
import { ThemeMode } from '@/contexts/ThemeContext';
/**
* Claude-themed syntax highlighting theme factory
* Returns different syntax themes based on the current theme mode
*
* @param theme - The current theme mode
* @returns Prism syntax highlighting theme object
*/
export const getClaudeSyntaxTheme = (theme: ThemeMode): any => {
const themes = {
dark: {
base: '#e3e8f0',
background: 'transparent',
comment: '#6b7280',
punctuation: '#9ca3af',
property: '#f59e0b', // Amber/Orange
tag: '#8b5cf6', // Violet
string: '#10b981', // Emerald Green
function: '#818cf8', // Indigo
keyword: '#c084fc', // Light Violet
variable: '#a78bfa', // Light Purple
operator: '#9ca3af',
},
gray: {
base: '#e3e8f0',
background: 'transparent',
comment: '#71717a',
punctuation: '#a1a1aa',
property: '#fbbf24', // Yellow
tag: '#a78bfa', // Light Purple
string: '#34d399', // Green
function: '#93bbfc', // Light Blue
keyword: '#d8b4fe', // Light Purple
variable: '#c084fc', // Purple
operator: '#a1a1aa',
},
light: {
base: '#1f2937',
background: 'transparent',
comment: '#9ca3af',
punctuation: '#6b7280',
property: '#dc2626', // Red
tag: '#7c3aed', // Purple
string: '#059669', // Green
function: '#2563eb', // Blue
keyword: '#9333ea', // Purple
variable: '#8b5cf6', // Violet
operator: '#6b7280',
},
white: {
base: '#000000',
background: 'transparent',
comment: '#6b7280',
punctuation: '#374151',
property: '#dc2626', // Red
tag: '#5b21b6', // Deep Purple
string: '#047857', // Dark Green
function: '#1e40af', // Dark Blue
keyword: '#6b21a8', // Dark Purple
variable: '#6d28d9', // Dark Violet
operator: '#374151',
},
custom: {
// Default to dark theme colors for custom
base: '#e3e8f0',
background: 'transparent',
comment: '#6b7280',
punctuation: '#9ca3af',
property: '#f59e0b',
tag: '#8b5cf6',
string: '#10b981',
function: '#818cf8',
keyword: '#c084fc',
variable: '#a78bfa',
operator: '#9ca3af',
}
};
const colors = themes[theme] || themes.dark;
return {
'code[class*="language-"]': {
color: colors.base,
background: colors.background,
textShadow: 'none',
fontFamily: 'var(--font-mono)',
fontSize: '0.875em',
textAlign: 'left',
whiteSpace: 'pre',
wordSpacing: 'normal',
wordBreak: 'normal',
wordWrap: 'normal',
lineHeight: '1.5',
MozTabSize: '4',
OTabSize: '4',
tabSize: '4',
WebkitHyphens: 'none',
MozHyphens: 'none',
msHyphens: 'none',
hyphens: 'none',
},
'pre[class*="language-"]': {
color: colors.base,
background: colors.background,
textShadow: 'none',
fontFamily: 'var(--font-mono)',
fontSize: '0.875em',
textAlign: 'left',
whiteSpace: 'pre',
wordSpacing: 'normal',
wordBreak: 'normal',
wordWrap: 'normal',
lineHeight: '1.5',
MozTabSize: '4',
OTabSize: '4',
tabSize: '4',
WebkitHyphens: 'none',
MozHyphens: 'none',
msHyphens: 'none',
hyphens: 'none',
padding: '1em',
margin: '0',
overflow: 'auto',
},
':not(pre) > code[class*="language-"]': {
background: theme === 'light'
? 'rgba(139, 92, 246, 0.1)'
: 'rgba(139, 92, 246, 0.1)',
padding: '0.1em 0.3em',
borderRadius: '0.3em',
whiteSpace: 'normal',
},
'comment': {
color: colors.comment,
fontStyle: 'italic',
},
'prolog': {
color: colors.comment,
},
'doctype': {
color: colors.comment,
},
'cdata': {
color: colors.comment,
},
'punctuation': {
color: colors.punctuation,
},
'namespace': {
opacity: '0.7',
},
'property': {
color: colors.property,
},
'tag': {
color: colors.tag,
},
'boolean': {
color: colors.property,
},
'number': {
color: colors.property,
},
'constant': {
color: colors.property,
},
'symbol': {
color: colors.property,
},
'deleted': {
color: '#ef4444',
},
'selector': {
color: colors.variable,
},
'attr-name': {
color: colors.variable,
},
'string': {
color: colors.string,
},
'char': {
color: colors.string,
},
'builtin': {
color: colors.tag,
},
'url': {
color: colors.string,
},
'inserted': {
color: colors.string,
},
'entity': {
color: colors.variable,
cursor: 'help',
},
'atrule': {
color: colors.keyword,
},
'attr-value': {
color: colors.string,
},
'keyword': {
color: colors.keyword,
},
'function': {
color: colors.function,
},
'class-name': {
color: colors.property,
},
'regex': {
color: '#06b6d4', // Cyan
},
'important': {
color: colors.property,
fontWeight: 'bold',
},
'variable': {
color: colors.variable,
},
'bold': {
fontWeight: 'bold',
},
'italic': {
fontStyle: 'italic',
},
'operator': {
color: colors.operator,
},
'script': {
color: colors.base,
},
'parameter': {
color: colors.property,
},
'method': {
color: colors.function,
},
'field': {
color: colors.property,
},
'annotation': {
color: colors.comment,
},
'type': {
color: colors.variable,
},
'module': {
color: colors.tag,
},
};
};
// Export default dark theme for backward compatibility
export const claudeSyntaxTheme = getClaudeSyntaxTheme('dark');