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

Function detectJetBrainsTheme

cli/src/utils/theme-system.ts:471–499  ·  view source on GitHub ↗
(
  env: CliEnv = getCliEnv(),
)

Source from the content-addressed store, hash-verified

469}
470
471const detectJetBrainsTheme = (
472 env: CliEnv = getCliEnv(),
473): ThemeName | null => {
474 if (!isJetBrainsTerminal(env)) {
475 return null
476 }
477
478 const lafPaths = collectExistingPaths(resolveJetBrainsLafPaths(env))
479
480 for (const lafPath of lafPaths) {
481 const content = safeReadFile(lafPath)
482 if (!content) continue
483 const theme = extractJetBrainsTheme(content)
484 if (theme) {
485 return theme
486 }
487
488 // If extractJetBrainsTheme returned null, check if autodetect is enabled
489 // and fall back to platform detection
490 const autodetectMatch = content.match(
491 /<component[^>]+name="LafManager"[^>]+autodetect="(true|false)"/i,
492 )
493 if (autodetectMatch?.[1]?.toLowerCase() === 'true') {
494 return detectPlatformTheme()
495 }
496 }
497
498 return null
499}
500
501const extractZedTheme = (content: string): ThemeName | null => {
502 try {

Callers 1

detectIDEThemeFunction · 0.85

Calls 7

getCliEnvFunction · 0.90
isJetBrainsTerminalFunction · 0.85
collectExistingPathsFunction · 0.85
resolveJetBrainsLafPathsFunction · 0.85
safeReadFileFunction · 0.85
extractJetBrainsThemeFunction · 0.85
detectPlatformThemeFunction · 0.85

Tested by

no test coverage detected