-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShow-TerminalThemes.ps1
More file actions
24 lines (22 loc) · 896 Bytes
/
Show-TerminalThemes.ps1
File metadata and controls
24 lines (22 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ErrorActionPreference = 'Stop'
ColorTool.exe -x -c -a
function map_ranges($input_start, $input_end, $out_start, $out_end, $index) {
$num_elements_out = ($out_end - $out_start) + 1
$num_elements_in = ($input_end - $input_start) + 1
# https://stackoverflow.com/a/5732390/12406510
return [math]::floor(($num_elements_out / $num_elements_in) * $index + $out_start)
}
$themes = (Get-Command ColorTool.exe | Split-Path -parent |
Join-Path -ChildPath "schemes" | Get-ChildItem).Name
for ($i = 0; $i -lt $themes.Count; $i++) {
ColorTool.exe -x -q $themes[$i]
Write-Progress -Activity "theme:" -Status $themes[$i] -PercentComplete (map_ranges 0 $themes.Count 1 100 $i)
switch ([console]::ReadKey($true).KeyChar) {
'q' { return; }
'f' { $i += 9 }
'e' { colortool -t $themes[$i] | Select-Object -Skip 1 | Set-Clipboard }
'b' { $i = $themes.count - 2 }
'p' { $i -= 2 }
Default {}
}
}