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

Function detectWindowsPowerShellTheme

cli/src/utils/theme-system.ts:784–825  ·  view source on GitHub ↗

* Detect Windows PowerShell background color theme * Uses PowerShell's (Get-Host).UI.RawUI.BackgroundColor command

()

Source from the content-addressed store, hash-verified

782 * Uses PowerShell's (Get-Host).UI.RawUI.BackgroundColor command
783 */
784function detectWindowsPowerShellTheme(): ThemeName | null {
785 if (process.platform !== 'win32') return null
786
787 const bgColor = runSystemCommand([
788 'powershell',
789 '-NoProfile',
790 '-Command',
791 '(Get-Host).UI.RawUI.BackgroundColor',
792 ])
793
794 if (!bgColor) return null
795
796 const colorLower = bgColor.toLowerCase()
797
798 // Dark background colors in PowerShell
799 const darkColors = [
800 'black',
801 'darkblue',
802 'darkgreen',
803 'darkcyan',
804 'darkred',
805 'darkmagenta',
806 'darkyellow',
807 'darkgray',
808 ]
809 // Light background colors in PowerShell
810 const lightColors = [
811 'gray',
812 'blue',
813 'green',
814 'cyan',
815 'red',
816 'magenta',
817 'yellow',
818 'white',
819 ]
820
821 if (darkColors.includes(colorLower)) return 'dark'
822 if (lightColors.includes(colorLower)) return 'light'
823
824 return null
825}
826
827export const detectTerminalOverrides = (): ThemeName | null => {
828 return null

Callers 1

detectPlatformThemeFunction · 0.85

Calls 1

runSystemCommandFunction · 0.85

Tested by

no test coverage detected