MCPcopy Create free account
hub / github.com/codeaashu/claude-code / buildTheme

Function buildTheme

src/native-ts/color-diff/index.ts:282–362  ·  view source on GitHub ↗
(themeName: string, mode: ColorMode)

Source from the content-addressed store, hash-verified

280}
281
282function buildTheme(themeName: string, mode: ColorMode): Theme {
283 const isDark = themeName.includes('dark')
284 const isAnsi = themeName.includes('ansi')
285 const isDaltonized = themeName.includes('daltonized')
286 const tc = mode === 'truecolor'
287
288 if (isAnsi) {
289 return {
290 addLine: DEFAULT_BG,
291 addWord: DEFAULT_BG,
292 addDecoration: ansiIdx(10),
293 deleteLine: DEFAULT_BG,
294 deleteWord: DEFAULT_BG,
295 deleteDecoration: ansiIdx(9),
296 foreground: ansiIdx(7),
297 background: DEFAULT_BG,
298 scopes: ANSI_SCOPES,
299 }
300 }
301
302 if (isDark) {
303 const fg = rgb(248, 248, 242)
304 const deleteLine = rgb(61, 1, 0)
305 const deleteWord = rgb(92, 2, 0)
306 const deleteDecoration = rgb(220, 90, 90)
307 if (isDaltonized) {
308 return {
309 addLine: tc ? rgb(0, 27, 41) : ansiIdx(17),
310 addWord: tc ? rgb(0, 48, 71) : ansiIdx(24),
311 addDecoration: rgb(81, 160, 200),
312 deleteLine,
313 deleteWord,
314 deleteDecoration,
315 foreground: fg,
316 background: DEFAULT_BG,
317 scopes: MONOKAI_SCOPES,
318 }
319 }
320 return {
321 addLine: tc ? rgb(2, 40, 0) : ansiIdx(22),
322 addWord: tc ? rgb(4, 71, 0) : ansiIdx(28),
323 addDecoration: rgb(80, 200, 80),
324 deleteLine,
325 deleteWord,
326 deleteDecoration,
327 foreground: fg,
328 background: DEFAULT_BG,
329 scopes: MONOKAI_SCOPES,
330 }
331 }
332
333 // light
334 const fg = rgb(51, 51, 51)
335 const deleteLine = rgb(255, 220, 220)
336 const deleteWord = rgb(255, 199, 199)
337 const deleteDecoration = rgb(207, 34, 46)
338 if (isDaltonized) {
339 return {

Callers 2

renderMethod · 0.85
renderMethod · 0.85

Calls 2

ansiIdxFunction · 0.85
rgbFunction · 0.70

Tested by

no test coverage detected