Lisa,

I don't know if you are passing the RGB value as one specific field 
(255,255,255) or as three separate fields. But I found this script on a website 
when I googled RGB to Hex conversions and it works. You can place this entirely 
into one rule, or you could put the function part into the JavaScript Globals 
section and call it from different rules.

function toHex(N) {
if (N==null)  {
    return "00";
}
else  {
    N=parseInt(N);
    if (N==0 || isNaN(N))  {
        return "00";
    }
    else  {
        N=Math.max(0,N);
        N=Math.min(N,255);
        N=Math.round(N);
        return "0123456789ABCDEF".charAt((N-N%16)/16) +
            "0123456789ABCDEF".charAt(N%16);
        }
    }
}

var h1 = toHex(Field("R"));
var h2 = toHex(Field("G"));
var h3 = toHex(Field("B"));

return h1+h2+h3;

.....

If you are using three fields for the R G and B values then you could use this 
rule almost verbatim. If you are using one field to pass all three values then 
you need to break it up into individual values before you call your functions.

Cool thing about this rule is that even if a blank value is passed, the rule 
will value that as if it were a "0" instead of a blank.

Good luck,

---
David A. Sweet
Web Designer/Graphic Designer
HKM Direct Market Communications
A DirectConnectGroup Company


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 18, 2008 9:28 AM
To: FusionPro Users Forum
Subject: [fusionpro] RGB to Hex rule

Hi, Could someone help me out with a rule----

If Red = 255 return FF
If Green = 255 return FF
If Blue = 255 return FF

Then combine Red Green Blue to = FFFFFF

Which by itself isn’t a hard rule, but I need to incorporate the whole 256
possibilities of RGB. The client is sending in Data in RGB and from what
I’ve read I need the Hex equivalent to make it work. I’ve made an external
data file with RGB Values in col1 and the Hex equivalent in col2, I don’t
know how to incorporate that into a rule or if it’s even needed. Any help
would be appreciated.


+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
FusionPro 5.0 Now Available!
 

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.524 / Virus Database: 269.23.1/1384 - Release Date: 4/17/2008 3:47 
PM
 

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
FusionPro 5.0 Now Available!


Variable text on a curve and soft drop-shadows for variable text


LIMITED TIME upgrade offer of $299 per license for current customers:
http://fusionpro.printable.com/store/upgrade

New licenses available for $599 each at:
http://fusionpro.printable.com/store/

All FusionPro 5.0 customers to receive FusionPro 5.1 with
Adobe Acrobat 8 and InDesign CS3 support when released for FREE.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
--
Users of FusionPro Desktop have unlimited free email support. Contact Printable 
Support at [EMAIL PROTECTED]
--
View FusionPro Knowledge Base, FusionPro Samples at
www.printable.com/vdp/desktop.htm

--
You are currently subscribed to fusionpro as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
--


--
Note:  All e-mail sent to or from this address will be received or otherwise 
recorded by the e-mail recipients of this forum. It is subject to archival, 
monitoring or review by, and/or disclosure to someone other than the recipient. 
Our privacy policy is posted on www.printplanet.com
--

Reply via email to