Adobe 23101764 Scripting Guide - Page 97
Getting and converting colors
UPC - 718659340025
View all Adobe 23101764 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 97 highlights
Scripting Photoshop 3 Color objects 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 alert("It's an RGB color") 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 93