It's something that previews RGB and Hex colors, but the Hex portion is only working 50%. I'm very new to this stuff, and I couldn't figure it out.
If I were to type in a hex color containing no letters (990000), it comes out as black. Anyone know why?
EDIT: Also, if there's a formula to convert RGB to Hex and vice versa, let me know.
begin:
TextWindow.Clear()
TextWindow.Write("Hex (RRGGBB) or RGB (RRR, GGG, BBB)?")
hexorrgb = TextWindow.Read()
If hexorrgb = "Hex" Or hexorrgb = "hex" Then
Goto Hex
ElseIf hexorrgb = "RGB" or hexorrgb = "rgb" then
Goto RGB
endif
RGB:
TextWindow.Clear()
TextWindow.Write("Enter a value for Red: ")
red = TextWindow.Read()
If red > 255 Then
TextWindow.Write("ERROR: Value must be less than 255, please restart.")
Program.Delay(1500)
TextWindow.Clear()
Goto RGB
endif
TextWindow.Write("Enter a value for Green: ")
green = TextWindow.Read()
If green > 255 Then
TextWindow.Write("ERROR: Value must be less than 255, please restart.")
Program.Delay(1500)
TextWindow.Clear()
Goto RGB
endif
TextWindow.Write("Enter a value for Blue: ")
blue = TextWindow.Read()
If blue > 255 Then
TextWindow.Write("ERROR: Value must be less than 255, please restart.")
Program.Delay(1500)
TextWindow.Clear()
Goto RGB
endif
TextWindow.WriteLine("Showing RGB: " + red + ", " + green + ", " + blue)
bgcolor = GraphicsWindow.GetColorFromRGB(red, green, blue)
GraphicsWindow.Title = "RGB " + red + ", " + green + ", " + blue
GraphicsWindow.Height = 128
GraphicsWindow.Width = 384
GraphicsWindow.BackgroundColor = bgcolor
TextWindow.WriteLine("")
TextWindow.WriteLine("Press X to close, or R to restart.")
doagain = TextWindow.Read()
If doagain = "X" Or doagain = "x" Then
Program.End()
ElseIf doagain = "R" or doagain = "r" then
Goto begin
EndIf
Hex:
TextWindow.Write("Enter a value for Red: ")
red = TextWindow.Read()
TextWindow.Write("Enter a value for Green: ")
green = TextWindow.Read()
TextWindow.Write("Enter a value for Blue: ")
blue = TextWindow.Read()
TextWindow.WriteLine("Showing Hex: " + red + green + blue)
bgcolor = red + green + blue
GraphicsWindow.Title = "HEX " + red + green + blue
GraphicsWindow.Height = 128
GraphicsWindow.Width = 384
GraphicsWindow.BackgroundColor = "#" + bgcolor
TextWindow.WriteLine("")
TextWindow.WriteLine("Press X to close, or R to restart.")
doagain = TextWindow.Read()
If doagain = "X" Or doagain = "x" Then
Program.End()
ElseIf doagain = "R" or doagain = "r" then
Goto begin
EndIf
Screenshots below.