Solid Color Classes; Using Hex Values For Rgb Color; Getting And Converting Colors - Adobe 65048332 Manual

Scripting guide
Table of Contents

Advertisement

C
3: Scripting Photoshop
HAPTER

Solid color classes

The solid color classes available in Photoshop are illustrated below.
Color Classes
RGB
Color

Using hex values for RGB color

You can express RGB colors as hex (or hexadecimal) values. A hex value contains three pairs of numbers
which represent red, blue and green (in that order).
In AppleScript, the hex value is represented by the
you use the
In VBScript and JavaScript, the

Getting and converting colors

The following examples convert an RGB color to its CMYK equivalent.
AS
The following script, which assumes an RGB color model, gets the foreground color and then uses the
convert
get foreground color
convert color foreground color to CMYK
Look up the following in the Adobe Photoshop CS5 AppleScript Scripting Reference or in the Photoshop
AppleScript Dictionary:
In the "Objects" section, the
In the "Commands" section,
VBS
The following script uses an
determine the color model in use. The
object, the
equivalent.
Dim someColor
If (someColor.model = 2) Then
someColor.cmyk
'someColor.model = 2 indicates psColorModel --> 2 (psRGBModel)
End If
CMYK
Color
command described below to retrieve the hex value.
convert color
RGBColor
command of the
color
If Then
property of the
cmyk
Solid
Color
Gray
Color
hex value
object has a string property called
class to convert the color to its CMYK equivalent.
property of the class
foreground color
convert
statement and the
statement returns a
If Then
object then allows you to access the color with its CMYK
SolidColor
Lab
HSB
Color
Color
string property in class
HexValue/hexValue
application
property of the
model
SolidColor
SolidColor
Working with color objects 52
No
Color
, and
RGB hex color
.
object to
object; if it returns an
RGB

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

65048599Photoshop cs5

Table of Contents