Previous Document Next Document

Including queries in macros : Understanding the available query criteria : Querying colors


Querying colors

You can query the color properties of the shapes on a page or layer.

To access the color properties of the current shape, you must prepend the property name with the at sign ( @ ). Thus, @type calls the Color.Type property of the current shape.

 
You can call an expression without specifying the current shape. However, in this case, the @ operator is unavailable.

Color queries can return values of any of the other supported object types (see Understanding the available query criteria).

Colors support the following query criteria:

Query criteria
Description
Example and result
color.CMY()
Converts the color to CMY and returns a special version of the CQL color object that has three additional properties: C, M, and Y. These properties provide access to individual color components.
@fill.color.cmy.c = @outline.color.cmy.c
Checks whether the fill color and outline color have the same C value
color.CMYK()
Converts the color to CMYK and returns a special version of the CQL color object that has four additional properties: C, M, Y, and K. These properties provide access to individual color components.
@fill.color.cmyk[.c = .m]
Checks whether the fill color has the same C value and M value
color.COM()
Returns the COM object for the color. This allows access to properties and methods of the color object that are not exposed through CQL.
 
color.Gray()
Converts the color to grayscale and returns the gray- level value as an integer
@fill.gray < 128
Checks whether the gray-level value for the fill color is less than 128
color.HLS()
Converts the color to HLS and returns a special version of the CQL color object that has three additional properties: H, L, and S. These properties provide access to individual color components.
@fill.color.hls.s = 0
Checks whether the S value for the fill color is 0
color.HSB()
Converts the color to HSB and returns a special version of the CQL color object that has three additional properties: H, S, and B. These properties provide access to individual color components.
@fill.color.hsb.h = 270
Checks whether the H value for the fill color is 270
color.IsCMYK()
Return True if this is a CMYK color
 
color.IsGray()
Return True if the color contains only black component
 
color.IsSpot()
Returns True if the color is a spot color
 
color.IsTintable()
Returns True if the color can have tints
 
color.IsWhite()
Returns True if the color is pure white
 
color.Lab()
Converts the color to LAB and returns a special version of the CQL color object that has three additional properties: L, A, and B. These properties provide access to individual color components.
@fill.color.lab.l = 0 and @fill.color.lab.a = -10
Checks whether the L value for the fill color is 0 and the A value is -10
color.Name()
Returns the name of the color, or 'unnamed color' if the color doesn’t have a name
 
color.Palette()
Returns the name of the palette that the color belongs to, or an empty string if the color belongs to a custom palette
 
color.PaletteIndex()
Returns the index for the palette color. This method is available only for colors from fixed palettes.
 
color.RGB()
Converts the color to RGB and returns a special version of the CQL color object that has three additional properties: R, G, and B. These properties provide access to individual color components.
@fill.color.rgb.r = 255
Checks whether the R value for the fill color is 255
color.SourcePalette()
Returns the original palette name for userink colors
 
color.Tint()
Returns the tint value of a spot color
 
color.Type()
Returns a string representing the color model. This could be a value such as 'rgb', 'cmyk', or 'hsb'.
 
color.YIQ()
Converts the color to YIQ and returns a special version of the CQL color object that has three additional properties: Y, I, and Q. These properties provide access to individual color components.
@fill.color.yiq.y < 10
Checks whether the Y value for the fill color is less than 10

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.