Adobe 23101764 - Photoshop CS - PC Manual page 97

Scripting guide
Hide thumbs Also See for 23101764 - Photoshop CS - PC:
Table of Contents

Advertisement

3.15.2 Getting and converting colors
Here's how to get the foreground color in AppleScript.
get foreground color
This may return an RGB color and in some cases you may want the CMYK equivalent. To
convert an RGB color to CMYK in AppleScript you would write:
convert color foreground color to CMYK
VB/JS:
The foreground color returns a SolidColor object. You should use its model property to
determine the color model.
If (someColor.model = ColorModel.RGB) Then
End If
You can also ask the SolidColor object to convert its color to any of the supported models.
For example, writing:
someColor.cmyk
will return a CMYKColor object representing the CMYK version of the color in someColor
regardless of the color model of someColor.
The examples below show how to convert the foreground color to a Lab color.
AS:
-- Convert foreground application color to Lab
set myLabColor to convert color foreground color to Lab
VB:
' Get the foreground color as Lab
Dim myLabColor As Photoshop.LabColor
Set myLabColor = appRef.ForegroundColor.Lab
JS:
// Get the Lab color from the foreground color.
var myLabColor = foregroundColor.lab;
Photoshop CS Scripting Guide
alert("It's an RGB color")
Scripting Photoshop
Color objects
3
93

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop cs

Table of Contents