How to do it

We will assume that the input is going to be with or without the # (as in, 55bc9a or #55bc9a).

  1. Open a new PowerShell file and type the following:
$Rgb = Read-Host "Enter the hexadecimal RGB value"
$TrimmedRgb = $Rgb.Substring($Rgb.Length - 6)

$R = $TrimmedRgb.Substring(0, 2)
$G = $TrimmedRgb.Substring(2, 2)
$B = $TrimmedRgb.Substring(4, 2)

"Here are the R, G and B levels for the supplied hex value:"
$R, $G, $B | ForEach-Object { [int]("0x" + $PSItem) }
  1. Run the script.
  2. Enter any valid hexadecimal RGB value, with or without the preceding #. Press Enter.

Here is an example.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.93.221