How to Change the Background Color Based on Data from a Spool File Using PlanetPress Designer Version 7.6.2
In the spool file, I have an HTML color code (e.g., #870400
), and I need to change the background color based on this information. I understand that I will need to use the PlanetPress Talk language, but I seem to be making an error in my approach.
Please help
Thank You
I’d have a box on my page which is larger than the page itself so as to create your background and drive the color via global variables.
-
Create 4 global variables called “c”, “m”, “y”, “k”.
-
Add a PressTalk object on your page with the following PressTalk code:
% Set color dynamically
% 50, 0, 0, 50
moveto(0, 0)
setfillcolor([&c, &m, &y, &k])
lineto(&width, 0.0000)
lineto(&width, &height)
lineto(0.0000, &height)
lineto(0.0000, 0.0000)
closepath()
fill()
-
Set your PressTalk before at page level to drive the color based on your conditional logic:
if(1 = 1)
&c := 50
&m := 0
&y := 0
&k := 50
endif()
(Obviously my condition is just set to work all the time - alter this for your use case). Also change your CMYK values to match the color you have specified above (which I haven’t looked up).
You could achieve a similar thing with a function but this breaks it down to simple steps.
Hope this helps.
If the color code is in HTML format, it needs to be converted to CMYK. Alternatively, can we work directly with the HTML color code? (e.g., #870400
)
I found the answer - for that procedure I can see only CMYK no HTML:
5.1.139 SetFillColor (procedure)
Sets the colour used to paint the insides of any closed shapes when issuing a fill or a strokeandfill
command.
Syntax
setfillcolor( colour )
Argument
colour
Colour array that can be expressed expressed using one, three or four values ranging from 0 to 255. For
Grayscale, a single value is used in the form [K]. For the RGB model, three values are used in the form [R, G,
B]. For the CMYK model, four values are used in the form [C, M, Y, K].
Thank You - I will need to convert that data before