Edit in GitHubLog an issue


Represents a color, and allows for mapping into all available Photoshop color models.

When a property is accessed (either via read or write), the current color model of the SolidColor objects gets set to the space of the accessor. Photoshop internally converts the color across these color spaces using the Color Settings set by the user.

For example, to set the foreground color to red:

Copied to your clipboard
1const red = new SolidColor();
2red.rgb.red = 255;
3red.rgb.green = 0;
4red.rgb.blue = 0;
6app.foregroundColor = red;

To understand how color models change as you interact with a SolidColor object, please see example below:

Copied to your clipboard
1const c = new SolidColor();
2console.log(c.model); // By default, this will be ColorModel.RGB
4c.cmyk.cyan = 50; // Photoshop will convert the color to CMYK using Edit > Color Settings data
5console.log(c.model); // Now, the model will be ColorModel.CMYK
7c.rgb.green = 128; // Model will change back to ColorModel.RGB


cmykCMYKColorRead-writeThe color's representation in CMYK color space.
grayGrayColorRead-writeThe color's representation in grayscale.
hsbHSBColorRead-writeThe color's representation in HSB color space.
labLabColorRead-writeThe color's representation in LAB color space.
rgbRGBColorRead-writeThe color's representation in RGB color space.




True if the SolidColor object is visually equivalent to the specified color.

Both colors are converted to Lab colorspace, and the sum of their normalized squared Euclidian distance in each space is averaged across the three then compared to a small constant (3.5e-6).

Due to differences in coverage by various color spaces and clamping, a color that is converted from RGB to CMYK and back may not be visually equal.


Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.