icon-background-layer, which appears behind all other components of an icon. This layer can contain a monochrome or polychrome image, or can be of any G2 color. Unlike imported images in other layers, a polychrome image in an icon background layer appears in polychrome on the screen.An image in a background layer is called a background image, and the color of a colored background layer is called the background color. An icon background layer cannot simultaneously have both an background image and a background color.
To specify an icon background image for a class:
icon-background-layer section.
color image image-name at (x-position, y-position)
image-definition, and x-position and y-position give the position of the upper left corner of the image relative to the upper left corner of the icon.
corporate-logo is an image, the definition:
icon-background-layer: color image corporate-logo at (0,0)
If a background image is larger than the icon that displays it, G2 clips it to fit the available area, both in the Icon Viewer and on a workspace.
If you specify a background image that does not exist, G2 puts a warning in the class definition's
Notes attribute, but does not signal an error. The icon looks just as it would if the unresolved definition did not exist.A background image definition applies to all instances of a class: you cannot change background images per-instance.
Various GIFs that can be used as icon background images are available in the G2
demos directory, as described under GIF Files.
Specifying a Background Color
A background color can be specified explicitly or by naming a region, in which case the background layer has the color of that region. When a region gives the background color, the color can be changed programmatically. A background color completely fills the background of an icon, irrespective of the icon's size.
To specify an icon background color for a class:
Icon-background-layer section.
icon-background-layer: red
icon-background-layer: my-region
my-region is any defined region.
To change the icon background color of an instance:
change the region-name icon-color of instance to color
instance: the instance whose background color is to change
color: any G2 color
change the my-region icon-color of my-instance to green