Storing color information?

N1c0_ds

Active Member
Licensed User
Is there a way to store a color as a variable? I want to save color information in a text file and then set it to a control at launch.

Any idea on how I could do that?
 

klaus

Expert
Licensed User
No problem:

For example:
Col=Button1.Color

in the Save routine
FileWrite(c1,Col)

in the Load routine
Col=FileRead(c1)

Panel1.Color=Col

Best regards.
 

derez

Expert
Licensed User
Getting the color coordinates

Is there a way to get by code the color coordinates (R,G,B) of a color which is defined as a single (color) variable ?

for example - how do you know the RGB of cYellow ?

thanks
 

agraham

Expert
Licensed User
Help->MainHelp->Keywords->General
B4X:
Sub Globals
      Dim Type (R,G,B) clr
End Sub


Sub App_Start
      Form1.Show
      clr() = GetRGB(Form1.Color)
      Msgbox("Red=" & clr.R & " Green=" & clr.G & " Blue=" & clr.B)
End Sub
 
Top