Jump to content

Adding custom CMYK builds


esmith

Recommended Posts

I have a project with multiple templates which all use a common library of colors. The client likes to add/remove colors on occasion and sometimes edits a color's build at the last minute. I had been creating/editing colors in the Colors dialog for each of the templates, but this is getting to be quite tedious, especially when adding new templates and setting up 24+ custom colors.

 

I noticed on the forum that I could add tags to my text in the form of <color cmyk="00000000"> but apparently the value must be converted to hex format rather than decimal. :eek:

 

FEATURE REQUEST: Update the color tag to accept CMYK input in standard decimal format!

 

Until my feature request is implemented, I wrote a function that converts a CMYK color build to its 8-character hex format to appease the FP gods. This way I can enter my values in an OnJobStart callback rule and convert to the proper format when generating my tagged text. I can add/edit colors much easier in JavaScript than by accessing the Colors dialog, especially since I have a single, common JavaScript file that I load for every template -- I can now make the changes in one place for everything. :cool:

 

var color = [0,83,54,16]; // [C,M,Y,K]

function cmyk2hex(cmykArr) {
   var hexBuild = [];
   for (var i=0; i<cmykArr.length; i++) {
       var thisColor = Math.round(cmykArr[i] * 2.55);
       hexBuild[i] = thisColor.toString(16);
       if (hexBuild[i].length == 1) hexBuild[i] = "0" + thisColor;
   }
   return hexBuild.join("");
}

return cmyk2hex(color);

Edited by esmith
clarification
Link to comment
Share on other sites

I have a project with multiple templates which all use a common library of colors. The client likes to add/remove colors on occasion and sometimes edits a color's build at the last minute. I had been creating/editing colors in the Colors dialog for each of the templates, but this is getting to be quite tedious, especially when adding new templates and setting up 24+ custom colors.

If you ever find yourself doing some kind of tedious, repetitive task like this, there's almost always a way to automate it.

I noticed on the forum that I could add tags to my text in the form of <color cmyk="00000000"> but apparently the value must be converted to hex format rather than decimal. :eek:

 

FEATURE REQUEST: Update the color tag to accept CMYK input in standard decimal format!

Well, I could quibble about whether decimal format is actually more "standard" than hexadecimal. FusionPro's tagged markup is based on HTML, which uses hexadecimal representations for color values in tags such as <font color="#ff0000"> and <BODY BGCOLOR="#ff6600">. Computers store data in binary, which is more easily expressed in a "power of two" numbering system like octal or hexadecimal than a base-ten system like decimal.

 

Anyway, what exactly do you suggest? Can you provide an example of what a tag would look like with decimal values? Would it be something like <cmyk(255,0,0,0)">? Would it be based on a range of 0 to 100, or 0 to 255?

Until my feature request is implemented, I wrote a function that converts a CMYK color build to its 8-character hex format to appease the FP gods. This way I can enter my values in an OnJobStart callback rule and convert to the proper format when generating my tagged text. I can add/edit colors much easier in JavaScript than by accessing the Colors dialog, especially since I have a single, common JavaScript file that I load for every template -- I can now make the changes in one place for everything. :cool:

 

var color = [0,83,54,16]; // [C,M,Y,K]

function cmyk2hex(cmykArr) {
   var hexBuild = [];
   for (var i=0; i<cmykArr.length; i++) {
       var thisColor = Math.round(cmykArr[i] * 2.55);
       hexBuild[i] = thisColor.toString(16);
       if (hexBuild[i].length == 1) hexBuild[i] = "0" + thisColor;
   }
   return hexBuild.join("");
}

return cmyk2hex(color);

That's a nice solution. However, in FusionPro 8.1, there's already a much easier, built-in way to do this:

var myColor = new FusionProColor("Your Custom Color Name", 100, 0, 0, 0);
return '<color name="Your Custom Color Name">Hi there!';

Here, you can directly specify the color values as percentages (0 to 100), which looks like what you already have in your data. You can use this for things like frame border and shade colors too, as well as text. More info here:

http://forums.pti.com/showthread.php?p=11580#post11580

[url=http://forums.pti.com/showthread.php?p=11580#post11580][/url]

Link to comment
Share on other sites

Well, I could quibble about whether decimal format is actually more "standard" than hexadecimal. FusionPro's tagged markup is based on HTML, which uses hexadecimal representations for color values in tags such as <font color="#ff0000"> and <BODY BGCOLOR="#ff6600">.

Hexadecimal is certainly standard on the web where RGB colors are the norm. But decimal values are used in printing which is the primary use for FusionPro, no? I have not found anywhere else where CMYK values are entered in hex format.

 

Anyway, what exactly do you suggest? Can you provide an example of what a tag would look like with decimal values? Would it be something like <cmyk(255,0,0,0)">? Would it be based on a range of 0 to 100, or 0 to 255?

If i get to pick, then yes <color cmyk="100,0,100,0">green</color> would be nice. Something in decimal notation; the same as is required in the Color dialog box.

 

var myColor = new FusionProColor("Your Custom Color Name", 100, 0, 0, 0);
return '<color name="Your Custom Color Name">Hi there!';

Here, you can directly specify the color values as percentages (0 to 100), which looks like what you already have in your data.

While we are on the topic of features -- have you ever seen Microsoft's Clippy who gives advice as you do things in Word? I would like to see FP implement Korny, who sits in the upper corner and suggests simple solutions BEFORE I invest the time figuring out how to do something the hard way. :D

Link to comment
Share on other sites

Hexadecimal is certainly standard on the web where RGB colors are the norm. But decimal values are used in printing which is the primary use for FusionPro, no?

When you say, "used in printing," that's a pretty broad statement. There are lots of applications and formats and types of markup used in the printing industry.

 

At any rate, values are values, and numbers are numbers, whereas decimal and hexadecimal are representations of numbers (values). There's no one representation which is more "correct" than any other, nor, I maintain, more "standard." Nor is there any technical reason why a range should necessarily be 0 to 100 instead of 0 to 255 (FF in hex).

I have not found anywhere else where CMYK values are entered in hex format.

Well, except for HTML tagging, which is what our tagging is based upon. We are talking about tagging here, not a GUI or some other dialog. FusionPro's tagging might not match what you see in any dialog, even in FusionPro itself, but if you're looking for something to compare it to, HTML tagging is the best comparison I can think of. And HTML tagging does indeed use hexadecimal values.

If i get to pick, then yes <color cmyk="100,0,100,0">green</color> would be nice.

That's a good suggestion, although I'm not sure it's obvious that it's a percentage. It's also very close to the current syntax. Maybe something like this would be better: <color max="100" value="cmyk(100,0,100,0)">.

Something in decimal notation; the same as is required in the Color dialog box.

Again, tagging doesn't always match what's in the GUI; it's modeled after HTML tagging.

 

But that doesn't mean we can't add functionality, as long as the older functionality remains the same, and I do appreciate any suggestions to make the product better.

 

On the other hand, with JavaScript, you can massage just about any input data into the format that FusionPro's tagging requires. Even if we changed the format of the tag itself, building up tags isn't something that is easily done without JavaScript, so this is all getting into more advanced territory than simply specifying a color in the Colors dialog and selecting it in the Text Editor.

While we are on the topic of features -- have you ever seen Microsoft's Clippy who gives advice as you do things in Word? I would like to see FP implement Korny, who sits in the upper corner and suggests simple solutions BEFORE I invest the time figuring out how to do something the hard way. :D

LOL, I'll see if I can add that for you!

Link to comment
Share on other sites

You have my vote for this feature as well. There is something similar in pitstop where you can choose between percentile based (like the max=100 attribute suggested) or 255 based.

 

Incidentally Eric, not sure if you remember this one from last year: http://forums.pti.com/showthread.php?t=2701

I based that on hyphens as that's whats used in InDesign when you build colors without naming them. Commas could easily be used instead.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...