Adobe PHOTOSHOP CS 2.0 - SCRIPTING GUIDE Manual page 68

Table of Contents

Advertisement

Adobe Photoshop CS2 Scripting Guide
solidColorRef.cmyk.magenta = 90
solidColorRef.cmyk.yellow = 50
solidColorRef.cmyk.black = 50
foregroundColor = solidColorRef
Solid Color Classes
The solid color classes available in Photoshop CS2 are illustrated below.
Color Classes
RGB
Color
Using Hex Values
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 RGBColor object has a string property called
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 CS2 AppleScript Scripting Reference:
In the "Objects" chapter, the
In the "Commands" chapter,
VBS
The following script uses an
determine the color model in use. The
object, the
Dim someColor
If (someColor.model = 2) Then
CMYK
Color
command described below to retrieve the hex value.
convert color
command of the
color
foreground color
convert
If Then
property of the
cmyk
Photoshop CS2
Solid
Color
Gray
Color
hex value
class to convert the color to its CMYK equivalent.
property of the
statement and the
statement returns a
If Then
object then converts the color to its CMYK equivalent.
SolidColor
Lab
HSB
Color
Color
string property in class
HexValue/hexValue
Class application
property of the
model
SolidColor
SolidColor
Scripting Photoshop CS2
No
Color
, and
RGB hex color
.
object to
object; if it returns an
RGB
64

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop cs2

Table of Contents