Skip to content

Instantly share code, notes, and snippets.

@gexplorer
Created November 19, 2019 10:41
Show Gist options
  • Save gexplorer/53ef5c8143be56053963b275becac9ca to your computer and use it in GitHub Desktop.
Save gexplorer/53ef5c8143be56053963b275becac9ca to your computer and use it in GitHub Desktop.
PowerShell profile
ColorTool.exe -q custom.itermcolors
# $colorScheme = @{
# None = @("Gray", "Black");
# Comment = @("DarkMagenta", "Black");
# Keyword = @("DarkGreen", "Black");
# String = @("DarkBlue", "Black");
# Operator = @("DarkRed", "Black");
# Variable = @("DarkGreen", "Black");
# Command = @("Gray", "Black");
# Parameter = @("DarkGray", "Black");
# Type = @("DarkGray", "Black");
# Number = @("DarkGray", "Black");
# Member = @("DarkGray", "Black");
# }
Set-PSReadLineOption -colors @{
None = 'Gray'
Comment = 'DarkMagenta'
Keyword = 'DarkGreen'
String = 'DarkBlue'
Operator = 'DarkRed'
Variable = 'DarkGreen'
Command = 'DarkGray'
Parameter = 'DarkGray'
Type = 'DarkGray'
Number = 'DarkGray'
Member = 'DarkGray'
ContinuationPrompt = 'DarkGray'
Default = 'DarkGray'
}
# $colorScheme.Keys | % { Set-PSReadlineOption -TokenKind $_ -ForegroundColor $colorScheme[$_][0] -BackgroundColor $colorScheme[$_][1] }
# function Print-Color {
# param([string]$color, [string]$darkColor)
# Write-Host $color": " -NoNewline
# Write-Host $color -ForegroundColor $color -NoNewline
# if ($darkColor -ne "") {
# Write-Host " | " -NoNewline
# Write-Host $darkColor -ForegroundColor $darkColor -NoNewline
# }
# Write-Host ""
# }
# CommandBackgroundColor : Black
# CommandForegroundColor : Gray
# CommentBackgroundColor : DarkMagenta
# CommentForegroundColor : DarkMagenta
# DefaultTokenBackgroundColor : Black
# DefaultTokenForegroundColor : Gray
# EmphasisBackgroundColor : DarkMagenta
# EmphasisForegroundColor : Cyan
# ErrorBackgroundColor : DarkMagenta
# ErrorForegroundColor : Red
# KeywordBackgroundColor : DarkMagenta
# KeywordForegroundColor : DarkGreen
# MemberBackgroundColor : DarkMagenta
# MemberForegroundColor : DarkGray
# NumberBackgroundColor : DarkMagenta
# NumberForegroundColor : DarkGray
# OperatorBackgroundColor : DarkMagenta
# OperatorForegroundColor : DarkRed
# ParameterBackgroundColor : Black
# ParameterForegroundColor : DarkGray
# StringBackgroundColor : DarkMagenta
# StringForegroundColor : DarkBlue
# TypeBackgroundColor : DarkMagenta
# TypeForegroundColor : DarkGray
# VariableBackgroundColor : DarkMagenta
# VariableForegroundColor : DarkGreen
# Print-Color "White"
# Print-Color "Black"
# Print-Color "Gray" "DarkGray"
# Print-Color "Blue" "DarkBlue"
# Print-Color "Red" "DarkRed"
# Print-Color "Magenta" "DarkMagenta"
# Print-Color "Green" "DarkGreen"
# Print-Color "Cyan" "DarkCyan"
# Print-Color "Yellow" "DarkYellow"
# Chocolatey profile
#$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
#if (Test-Path($ChocolateyProfile)) {
# Import-Module "$ChocolateyProfile"
# }
Set-PSReadlineOption -BellStyle None
Set-PSReadlineOption -EditMode Emacs
function Test-Administrator {
$user = [Security.Principal.WindowsIdentity]::GetCurrent();
(New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}
function prompt {
$realLASTEXITCODE = $LASTEXITCODE
$rootIndicator = ">"
Write-Host
if (Test-Administrator) {
$rootIndicator = "$"
}
# Write-Host "$ENV:USERNAME@" -NoNewline -ForegroundColor DarkYellow
# Write-Host "$ENV:COMPUTERNAME" -NoNewline -ForegroundColor Magenta
if ($s -ne $null) {
Write-Host " (`$s: " -NoNewline -ForegroundColor DarkGray
Write-Host "$($s.Name)" -NoNewline -ForegroundColor Yellow
Write-Host ") " -NoNewline -ForegroundColor DarkGray
}
# Write-Host "→ " -NoNewline -ForegroundColor DarkGreen
Write-Host $($(Get-Location) -replace ($env:USERPROFILE).Replace('\','\\'), "~") -ForegroundColor DarkCyan
# Write-Host " : " -NoNewline -ForegroundColor DarkGray
# Write-Host (Get-Date -Format G) -NoNewline
# Write-Host " : " -NoNewline -ForegroundColor DarkGray
$global:LASTEXITCODE = $realLASTEXITCODE
Write-Host $rootIndicator -NoNewline
return " "
}
& "$PSScriptRoot\ColorTheme.ps1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment