Color

Now reading version 20. For the latest, read: Color for version 21

Parent page: Schematic Query Functions - Fields

Summary

Returns all objects whose Color property complies with the Query.

Syntax

Color : Numeric_String
Color : Number

The Color keyword can always be used in conjunction with a Numeric_String. It can alternatively be used in conjunction with a Number, but only when all Part objects (which do not have a Color property) have been totally excluded by one or more preceding entries within the Query expression. Either use entries in the expression such as Color <> '', Color > '', ObjectKind <> 'Part', or Not IsPart. Alternatively, use entries specifically targeting non-part objects, such as IsArc, etc.

The color corresponding to a particular number can be deduced from the following relationship:

65536 * Blue + 256 * Green + Red

where the Blue, Green, and Red components each have a value between 0 and 255 (inclusive).

When the Color keyword can be used in conjunction with a Number, it is possible to individually evaluate the values of each of the Color property's Blue, Green, and Red components, by using the following constructs:

  • Blue = Color Div 65536
  • Green = Color Div 256 Mod 256
  • Red = Color Mod 256

Example Usage

Color = '0'
Color <> '' && Color = 0

Returns all objects whose Color property is 0 (which corresponds to values of Blue = 0, Green = 0, and Red = 0).

Color = '16711680'
Color > '' && Color = 16711680

Returns all objects whose Color property is 16711680 (which corresponds to values of Blue = 255, Green = 0, and Red = 0).

Color <> '16777215'
Returns all objects except those whose Color property is 16777215 (which corresponds to values of Blue = 255, Green = 255, and Red = 255).

ObjectKind <> 'Part' && Color <> 16777215
Returns all objects – except parts – whose Color property is 16777215.

Not IsPart && Color Div 65536 >= 96 && Color Div 256 Mod 256 Between 64 And 192 && Color Mod 256 <= 128
Returns all objects – except parts – whose Color property is such that the Blue component has a value which is greater than or equal to 96, the Green component has a value which is greater than or equal to 64 and less than or equal to 192, and the Red component has a value which is less than or equal to 128.

IsArc Or IsBezier && Color Mod 256 Between 64 And 192
Returns all arc and Bezier objects whose Color property's Red component has a value which is greater than or equal to 64 and less than or equal to 192.

 

If you find an issue, select the text/image and pressCtrl + Enterto send us your feedback.
Note

The features available depend on your Altium product access level. Compare features included in the various levels of Altium Designer Software Subscription and functionality delivered through applications provided by the Altium 365 platform.

If you don’t see a discussed feature in your software, contact Altium Sales to find out more.