Comparing Colors - Adobe 23102480 - Photoshop CS3 - PC Programming Manual

Scripting guide
Table of Contents

Advertisement

Adobe Photoshop CS3 Scripting Guide
AS
The following script, which assumes an RGB color model, gets the foreground color and then uses the
command of the
convert
get foreground color
convert color foreground color to CMYK
Look up the following in the Adobe Photoshop CS3 AppleScript Scripting Reference or in the Photoshop CS3
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
Look up the following in the Adobe Photoshop CS3 Visual Basic Scripting Reference, or in the Visual Basic
Object Browser:
model
JS
This example uses the
be converted. The
way to access the cmyk equivalent of the rgb color.
var someColor = foregroundColor.cmyk
Look up the following in the Adobe Photoshop CS3 JavaScript Scripting Reference, or in the ExtendScript
Object Model Viewer:
as a property of the
cmyk
foregroundColor

Comparing Colors

Using the
statements return
AS:
if equal colors foreground color with background color then
VBS:
If (appRef.ForegroundColor.IsEqual(appRef.BackgroundColor)) Then
JS:
if (app.foregroundColor.isEqual(backgroundColor))
Getting a Web Safe Color
To convert a color to a web safe color use the
NearestWebColor/nearestWebColor
class to convert the color to its CMYK equivalent.
color
foreground color
convert
If Then
property of the
cmyk
SolidColor
and
as properties of the
cmyk
foregroundColor
property of the
cmyk
SolidColor
as a property of the
equal colors (IsEqual/isEqual)
if the foreground color is visually equal to background color.
true
Photoshop CS3
property of the class
statement and the
model
statement returns a
If Then
object then allows you to access the color with its CMYK
object
SolidColor
property of the
Application
object that
SolidColor
object
object
Application
command, you can compare colors. The following
web safe color
property of the
SolidColor
Scripting Photoshop CS3
application
property of the
SolidColor
object; if it returns an
SolidColor
object to get the original color to
refers to provides a
foregroundColor
command on AppleScript and the
object for VBScript and JavaScript.
52
object to
RGB

Advertisement

Table of Contents
loading

This manual is also suitable for:

13102498 - photoshop cs3 - macPhotoshop cs3

Table of Contents