Last active
January 4, 2016 04:19
-
-
Save fergus/8567876 to your computer and use it in GitHub Desktop.
This function returns accepts a string of three comma separated values and converts these to a Long value suitable for use in Excel.
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
Function Convert-RGBtoLong | |
( | |
[string] $RGBString = "0,160,175" #Teal | |
) | |
{ | |
$RGBLong = ([int]$RGBString.split(",")[2] *65536) + ([int]$RGBString.split(",")[1]*256) + [int]$RGBString.split(",")[0] | |
Write-Verbose "Convert-RGBtoLong: $RGBString = $RGBLong" | |
$RGBLong; | |
<# | |
.DESCRIPTION | |
Function Convert-RGBtoLong accepts a string of three comma seperated values and converts these to a Long value suitable for use in Excel. | |
.PARAMETER RGBString | |
String of three comma seperated values | |
.EXAMPLE | |
$connection = Convert-RGBtoLong ("198,217,45") | |
.OUTPUTS | |
long colour value | |
.NOTES | |
NAME: Convert-RGBtoLong | |
AUTHOR: Fergus Stevens | |
LASTEDIT: 30 Jan 2014 | |
.LINK | |
https://gist.github.com/fergus/8567876 | |
#Requires -Version 2.0 | |
#> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The long colour values have also been tested in Word.