RGBColor
RGBColor
Section titled “RGBColor”new RGBColor()
Description
Section titled “Description”An RGB Color specification, used to apply an RGB color to a layer or art item.
If the color space of a document is RGB and you specify the color value for a page item in that document using CMYK, Illustrator will translate the CMYK color specification into an RGB color specification. The same thing happens if the document’s color space is CMYK and you specify colors using RGB. Since this translation can lose information, you should specify colors using the class that matches the document’s actual color space.
Properties
Section titled “Properties”RGBColor.blue
Section titled “RGBColor.blue”rgbColor.blue
Description
Section titled “Description”The blue color value.
Range: 0.0 to 255.0.
Number (double).
RGBColor.green
Section titled “RGBColor.green”rgbColor.green
Description
Section titled “Description”The green color value.
Range: 0.0 to 255.0.
Number (double).
RGBColor.red
Section titled “RGBColor.red”rgbColor.red
Description
Section titled “Description”The red color value.
Range: 0.0 to 255.0.
Number (double).
RGBColor.typename
Section titled “RGBColor.typename”rgbColor.typename
Description
Section titled “Description”The class name of the referenced object.
String; read-only.
Example
Section titled “Example”Setting an RGB color
Section titled “Setting an RGB color”// Sets the default fill color in the current document to yellow.
if (app.documents.length > 0) { // Define the new color var newRGBColor = new RGBColor(); newRGBColor.red = 255; newRGBColor.green = 255; newRGBColor.blue = 0;
app.activeDocument.defaultFillColor = newRGBColor;}