05-01-2022, 10:48 PM
Well in case you haven't seen enough color pickers here is another. I run it independent of the QB64 program I am putting together and design colors and give them Const names and paste them in off Clipboard:
Code: (Select All)
_Title "Color CONST for _RGBA32(red, green, blue, alpha)" 'B+ 2019-05-19
'2019-05-26 update this for mouse inputs
'>>>>>>>>>>>> test your colors here
'>>>>>>>>>>>> then create and name Hex string CONSTs if you want to the Clipboard
'sample clipping
Const Purple = &HFFB400B4
Const Red = &HFFFA3232
Screen _NewImage(800, 600, 32)
_ScreenMove _Middle
If _Clipboard$ <> "" Then
Input "Clear clipboard? enter y for yes "; w$
If w$ = "y" Then _Clipboard$ = ""
End If
r = 128: g = 128: b = 128: a = 128
Color &HFFDDDDDD, 0
Do
Cls
MakeConst$ = "&H" + Right$(String$(8, "0") + Hex$(_RGBA32(r, g, b, a)), 8)
slider 16, 10, r, "Red"
slider 16, 60, g, "Green"
slider 16, 110, b, "Blue"
slider 16, 160, a, "Alpha"
_PrintString (250, 260), "Press c to create CONST for Clipboard"
_PrintString (210, 280), "Use this Hex string for color CONST: " + MakeConst$
Line (90, 300)-(710, 590), , B
Line (100, 310)-(700, 580), Val(MakeConst$), BF
While _MouseInput: Wend
mb = _MouseButton(1)
If mb Then 'clear it
mx = _MouseX: my = _MouseY
If mx >= 16 And mx <= 784 Then
If my >= 10 And my <= 50 Then
r = _Round((mx - 16) / 3)
ElseIf my >= 60 And my <= 100 Then
g = _Round((mx - 16) / 3)
ElseIf my >= 110 And my <= 150 Then
b = _Round((mx - 16) / 3)
ElseIf my >= 160 And my <= 200 Then
a = _Round((mx - 16) / 3)
End If
End If
End If
k$ = InKey$
If k$ = "q" Then Exit Do
If k$ = "c" Then
Locate 16, 30
Input "Enter name for your color CONST "; cname$
_Clipboard$ = _Clipboard$ + Chr$(10) + "CONST " + cname$ + " = " + MakeConst$
End If
_Display
_Limit 60
Loop
Sub slider (x, y, value, label$)
Select Case label$
Case "Red": c~& = &HFFFF0000
Case "Green": c~& = &HFF008800
Case "Blue": c~& = &HFF0000FF
Case "Alpha": c~& = &H88FFFFFF
End Select
Line (x, y)-Step(768, 40), c~&, B
Line (x, y)-Step(3 * value, 40), c~&, BF
s$ = label$ + " = " + _Trim$(Str$(value))
_PrintString (x + 384 - 4 * Len(s$), y + 12), s$
End Sub
b = b + ...