Jump to content

Creating a color not in the color library


Hadrian

Recommended Posts

Is there a way to create and apply a text frame color that is not in the color library? For example, dynamically create C=43 M=43 Y=0 K=0 based on a text field entry or say an image file that is named "043-043-000-000.jpg".

 

I know i would need to use something similar to the code below but that is referencing a color in the library. Is there a color value tag i can use?

 

theBox = FindTextFrame("box");
   theBox.fillColorName = "Red"

Link to comment
Share on other sites

No, you can only use a named color with the text frame properties.

 

However, you can use a "solid block" character, copyfitted to fill another frame behind your frame, with a tag to specify any arbitrary color, with a rule such as this:

return '<color cmyk=77777777><f name="Arial Unicode MS"><unicode>2588</unicode></f></color>';

Link to comment
Share on other sites

  • 1 year later...
No, you can only use a named color with the text frame properties.

This is no longer true. With FusionPro 8.1 or later, you can call “new FusionProColor” to create a color. The signature is:

new FusionProColor(name [,cyan] [,magenta] [,yellow] [,black]  [,isSpot])

Where the CYMK values are percentages. You can find this in the Building Blocks dialog, on the Objects tab, under the “Resources” node.

 

An example is:

var myColor = new FusionProColor("Brown", 0, 3, 5, 62);
FindTextFrame("Title").fillColorName = "Brown";

Of course, the values can come from data fields, like so:

var myColor = new FusionProColor("User Color", Int(Field("Cyan"),  Int(Field("Yellow"), Int(Field("Magenta"), Int(Field("Black"));
FindTextFrame("Title").fillColorName = "User Color";

Link to comment
Share on other sites

  • 3 months later...

I have been looking for a solution to add a custom color to the drop down for frame colors. Attached is an image to be clear where I am talking about.

 

Is this thread giving the solution? If so, where do I enter the code listed?

 

Thank you,

 

Andy

AddColor.jpg.35266ffad8c6e32bcc08330c61db59d2.jpg

Link to comment
Share on other sites

  • 10 months later...

Hi there, speaking of beginners :)

 

I'm trying to do this with a pantone chart data I have in tab.txt format.

 

I tried this code:

var myColor = new FusionProColor("isSpot", Int(Field("C")), Int(Field("M")), Int(Field("Y")), Int(Field("K")));

FindTextFrame("Box").fillColorName = "isSpot";

 

And it says It's not returning a value.

 

I really am stumbling through here so please forgive me if I missed something ridiculously simple. :confused:

 

I created a text frame and called it Box.

Then I tried to create a new rule with that code above.

 

My data file is just: [Name] [C] [M] [Y] [K]

with the corresponding cmyk values in each column.

 

My goal is to basically fill the box with that color. About 2800 or so colors :D and then impose it so I can make a color chart.

 

Anyone have an idea as to what I'm doing wrong? (or at least a solution to this problem)

 

Thanks for the help!

-Mike

Link to comment
Share on other sites

Are you using FP 8.1 or later? If not, that won't work.

 

If you are, make sure that the frame you want to fill the color with is called "Box" and make sure that you have that code in an OnRecordStart Callback rule.

Link to comment
Share on other sites

I tried this code:

var myColor = new FusionProColor("isSpot", Int(Field("C")), Int(Field("M")), Int(Field("Y")), Int(Field("K")));

FindTextFrame("Box").fillColorName = "isSpot";

 

And it says It's not returning a value.

You need to put the code in the OnRecordStart callback rule, not in a regular rule.

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...