MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / extractVSCodeTheme

Function extractVSCodeTheme

cli/src/utils/theme-system.ts:324–360  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

322}
323
324const extractVSCodeTheme = (content: string): ThemeName | null => {
325 // Try standard colorTheme setting
326 const colorThemeMatch = content.match(
327 /"workbench\.colorTheme"\s*:\s*"([^"]+)"/i,
328 )
329 if (colorThemeMatch) {
330 const inferred = inferThemeFromName(colorThemeMatch[1])
331 if (inferred) return inferred
332 }
333
334 // Check if auto-detect is enabled and try preferred themes
335 const autoDetectMatch = content.match(
336 /"window\.autoDetectColorScheme"\s*:\s*(true|false)/i,
337 )
338 const autoDetectEnabled = autoDetectMatch?.[1]?.toLowerCase() === 'true'
339
340 if (autoDetectEnabled) {
341 // Try to extract both preferred themes and infer from their names
342 const preferredDarkMatch = content.match(
343 /"workbench\.preferredDarkColorTheme"\s*:\s*"([^"]+)"/i,
344 )
345 if (preferredDarkMatch) {
346 const inferred = inferThemeFromName(preferredDarkMatch[1])
347 if (inferred) return inferred
348 }
349
350 const preferredLightMatch = content.match(
351 /"workbench\.preferredLightColorTheme"\s*:\s*"([^"]+)"/i,
352 )
353 if (preferredLightMatch) {
354 const inferred = inferThemeFromName(preferredLightMatch[1])
355 if (inferred) return inferred
356 }
357 }
358
359 return null
360}
361
362const extractJetBrainsTheme = (content: string): ThemeName | null => {
363 // Check if autodetect is enabled (Sync with OS setting)

Callers 1

detectVSCodeThemeFunction · 0.85

Calls 1

inferThemeFromNameFunction · 0.85

Tested by

no test coverage detected