Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save PlagueHO/aad6a07f51c4eb789bb36a5dd729c05e to your computer and use it in GitHub Desktop.
PowerShell example using a hash table and null coalescing to map colour name to value
$colourName = 'green'
$colourMap = @{
red = 0xFF0000
green = 0x00FF00
blue = 0x0000FF
white = 0xFFFFFF
}
$colourValue = ($colourMap[$colourName], 0x0, 1 -ne $null)[0] # Null Coalescing
return $colourValue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment