functions/private.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
#these are private functions function Get-RGB { [cmdletbinding()] [OutputType("RGB")] Param( [Parameter(Mandatory, HelpMessage = "Enter the name of a system color like Tomato")] [ValidateNotNullOrEmpty()] [string]$Name ) Try { $Color = [System.Drawing.Color]::FromName($Name) [PSCustomObject]@{ PSTypeName = "RGB" Name = $Name Red = $color.R Green = $color.G Blue = $color.B } } Catch { Throw $_ } } function Convert-RGBtoAnsi { #This will write an opening ANSI escape sequence to the pipeline [cmdletbinding()] [OutputType("String")] Param( [parameter(Position = 0, ValueFromPipelineByPropertyName)] [int]$Red, [parameter(Position = 1, ValueFromPipelineByPropertyName)] [int]$Green, [parameter(Position = 2, ValueFromPipelineByPropertyName)] [int]$Blue ) Process { "$([char]27)[38;2;{0};{1};{2}m" -f $red,$green,$blue } } |