Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
20 most used distinct visible colors
Message
From
07/12/2006 02:40:50
 
 
To
06/12/2006 23:24:42
Suhas Hegde
Dental Surgeon
Sirsi, India
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
01175481
Message ID:
01175510
Views:
10
To find the rgb values for any color:
?color2rgb(GetColor())
Here's my color2rgb function. It's a little "overkill" for your specific need, since it also can return only one color component, like ?color2rgb(16711808,'R') which will only give the red value. I need this functionality in some programs, so I created a generic function.
Function color2rgb
  Lparameters lnColor,lcColor
  Local lnRed,lnGreen,lnBlue,lxReturn
  lnRed = Mod(lnColor, 256)
  lnGreen = Mod(Bitrshift(lnColor, 8), 256)
  lnBlue = Mod(Bitrshift(lnColor, 16), 256)
  Do Case
    Case Pcount()=1
      lxReturn=n2c(lnRed)+','+n2c(lnGreen)+','+n2c(lnBlue)
    Case Upper(lcColor)='R'
      lxReturn=lnRed
    Case Upper(lcColor)='G'
      lxReturn=lnGreen
    Case Upper(lcColor)='B'
      lxReturn=lnBlue
    Otherwise
      lxReturn=-1
  Endcase
Return lxReturn
NB! Note that you can use the (numeric) return value from getcolor() almost anywhere, so there's really no reason to convert to RGB.

>hi,
>
>i need most commonly used 20 distint colors other than black and white
>
>CAn some1 list it please in RGB() format ?
>
>tia
>
>suhashegde
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform