Adobe 23102480 Scripting Guide - Page 51

Solid Color Classes, Using Hex Values for RGB Color, Getting and Converting Colors

Page 51 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 VBS 'create a solidColor array Dim solidColorRef Set solidColorRef = CreateObject("Photoshop.SolidColor") solidColorRef.CMYK.Cyan = 20 solidColorRef.CMYK.Magenta = 90 solidColorRef.CMYK.Yellow = 50 solidColorRef.CMYK.Black = 50 appRef.ForegroundColor = solidColorRef JS //create a solid color array var solidColorRef = new solidColor() solidColorRef.cmyk.cyan = 20 solidColorRef.cmyk.magenta = 90 solidColorRef.cmyk.yellow = 50 solidColorRef.cmyk.black = 50 foregroundColor = solidColorRef Solid Color Classes The solid color classes available in Photoshop CS3 are illustrated below. Scripting Photoshop CS3 51 Color Classes Solid Color RGB Color CMYK Color Gray Color HSB Color Lab Color No 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 hex value string property in class RGB hex color, and you use the convert color command described below to retrieve the hex value. In VBScript and JavaScript, the RGBColor object has a string property called HexValue/hexValue. Getting and Converting Colors The following examples convert an RGB color to its CMYK equivalent.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85

Photoshop CS3
Adobe Photoshop CS3
Scripting Guide
Scripting Photoshop CS3
51
VBS
'create a solidColor array
Dim solidColorRef
Set solidColorRef = CreateObject("Photoshop.SolidColor")
solidColorRef.CMYK.Cyan = 20
solidColorRef.CMYK.Magenta = 90
solidColorRef.CMYK.Yellow = 50
solidColorRef.CMYK.Black = 50
appRef.ForegroundColor = solidColorRef
JS
//create a solid color array
var solidColorRef = new solidColor()
solidColorRef.cmyk.cyan = 20
solidColorRef.cmyk.magenta = 90
solidColorRef.cmyk.yellow = 50
solidColorRef.cmyk.black = 50
foregroundColor = solidColorRef
Solid Color Classes
The solid color classes available in Photoshop CS3 are illustrated below.
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
hex value
string property in class
RGB hex color
, and
you use the
convert color
command described below to retrieve the hex value.
In VBScript and JavaScript, the
RGBColor
object has a string property called
HexValue/hexValue
.
Getting and Converting Colors
The following examples convert an RGB color to its CMYK equivalent.
RGB
Color
CMYK
Color
Gray
Color
HSB
Color
Lab
Color
No
Color
Solid
Color
Color Classes