Created
August 27, 2016 00:06
-
-
Save Xainey/733a76913b2692fc92a7bf3646f7b662 to your computer and use it in GitHub Desktop.
Helper Script to Install Themes for ConEmu.
This file contains hidden or 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
param | |
( | |
[string] $ThemeURL, | |
[string] $ConfigPath = "~\AppData\Roaming\ConEmu.xml" | |
) | |
cls | |
$ErrorActionPreference = "Stop" | |
#Config | |
$ConfigFile = Resolve-Path $ConfigPath | |
# Load XML | |
[xml] $Theme = (wget $ThemeURL) | |
[xml] $ConEmu = Get-Content $ConfigFile | |
$colors = $ConEmu.SelectSingleNode("//key[@name='Colors']") | |
if($colors -eq $null) | |
{ | |
Write-Host "Use Settings>Features>Colors and save a random scheme to generate missing XML. Then run again." | |
return | |
} | |
$presentNames = $colors.SelectNodes("key//value[@name='Name']").data | |
$newName = $theme.SelectNodes("key//value[@name='Name']").data | |
# Add theme if it doesnt already exist in $ConfigFile | |
if(!$presentNames.contains($newName)) | |
{ | |
Write-Host ("Adding Theme: {0}" -f $newName) | |
$colors.value.data = (1 + $colors.value.data).ToString() | |
$Theme.key.name = "Palette{0}" -f $colors.value.data | |
$colors.AppendChild($ConEmu.ImportNode($Theme.key, $true)) | Out-Null | |
} | |
#Save | |
Write-Host "Saving..." | |
$ConEmu.Save($ConfigFile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For installing Themes from https://github.com/joonro/ConEmu-Color-Themes
ConEmu.xml in default location: ~\AppData\Roaming\ConEmu.xml
if ConEmu.xml not in default path