Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RGB() to web colors
Message
De
30/08/2001 18:11:51
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00551143
Message ID:
00551146
Vues:
22
>A little while ago, there was a thread regarding converting the VFP RGB() color to a hex(?) number for display on a web page. Does anybody remember the solution? Basically, I want
RGB( 250, 238, 209 )
as my background color. Thanks.
>John

I believe it's in the FAQ here somewhere, but here's what I use.
     Procedure RGB2Hex(tnRGB,tlWeb)
          Local lcHex
          Assert Between(tnRGB, 0, 0xFFFFFF) ;
               Message("RGB value must be between 0 and " + Transform(0xFFFFFF))

          lcHex = Right(Transform(tnRGB, "@0"),6)
          ** hex colors are rrggbb, so turn around the result
          lcHex = Right(lcHex,2)+Substr(lcHex,3,2)+Left(lcHex,2)
          Return IIf(tlWeb,"#","")+lcHex
     EndProc
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform