Created
February 13, 2024 18:25
-
-
Save milnak/7ebf02930d238ce7d78c7c977d6cdf8a to your computer and use it in GitHub Desktop.
Set Putty session color themes and defaults
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tango Dark theme | |
$colors = @{ | |
# Default Foreground | |
'Colour0' = '187,187,187' | |
# Default Bold Foreground | |
'Colour1' = '255,255,255' | |
# Default Background | |
'Colour2' = '0,0,0' | |
# Dfeault Bold Background | |
'Colour3' = '85,85,85' | |
# Cursor Text | |
'Colour4' = '0,0,0' | |
# Cursor Colour | |
'Colour5' = '0,255,0' | |
# ANSI Black | |
'Colour6' = '0,0,0' | |
# ANSI Black Bold | |
'Colour7' = '85,87,83' | |
# ANSI Red | |
'Colour8' = '204,0,0' | |
# ANSI Red Bold | |
'Colour9' = '239,41,41' | |
# ANSI Green | |
'Colour10' = '78,154,6' | |
# ANSI Green Bold | |
'Colour11' = '138,226,52' | |
# ANSI Yellow | |
'Colour12' = '196,160,0' | |
# ANSI Yellow Bold | |
'Colour13' = '252,233,79' | |
# ANSI Blue | |
'Colour14' = '52,101,164' | |
# ANSI Blue Bold | |
'Colour15' = '114,159,207' | |
# ANSI Magenta | |
'Colour16' = '117,80,123' | |
# ANSI Magenta Bold | |
'Colour17' = '173,127,168' | |
# ANSI Cyan | |
'Colour18' = '6,152,154' | |
# ANSI Cyan Bold | |
'Colour19' = '52,226,226' | |
# ANSI White | |
'Colour20' = '211,215,207' | |
# ANSI White Bold | |
'Colour21' = '238,238,238' | |
} | |
$defaults = @{ | |
# Window | |
'TermHeight' = 40 | |
'TermWidth' = 120 | |
# Window | Appearance | |
'Font' = 'Cascadia Mono' | |
'FontHeight' = 11 | |
# Window | Behaviour | |
'AltSpace' = 1 | |
'WarnOnClose' = 0 | |
# Window | Translation | |
'FontVTMode' = 4 | |
'UTF8linedraw' = 1 | |
# Window | Colours | |
'UseSystemColours' = 0 | |
'Xterm256Colour' = 1 | |
'LineCodePage' = 'UTF-8' | |
# Connection | Data | |
'TerminalType' = 'putty-256color' | |
} | |
$PuttySessionPath = 'HKCU:\SOFTWARE\SimonTatham\PuTTY\Sessions' | |
$sessionKeys = Get-ChildItem $PuttySessionPath | Where-Object Property -contains 'HostName' | |
foreach ($key in $sessionKeys) { | |
# REVIEW: Skip entries where Protocol != 'ssh' ? | |
$session = $key.PSChildName | |
"Setting session '$session'" | |
# Set colors | |
foreach ($color in $colors.GetEnumerator()) { | |
Set-ItemProperty -Path "$PuttySessionPath\$session" -Name $color.Key -Value $color.Value | |
} | |
# Set defaults | |
foreach ($default in $defaults.GetEnumerator()) { | |
Set-ItemProperty -Path "$PuttySessionPath\$session" -Name $default.Key -Value $default.Value | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment