Adobe 23101335 Scripting Guide - Page 79
Comparing Colors, 3.14.4 Getting a Web Safe Color
UPC - 718659152833
View all Adobe 23101335 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 79 highlights
Scripting Photoshop 3 Color objects 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; 3.14.3 Comparing Colors Using the equal colors (IsEqual/isEqual) commands, you can easily compare colors. These methods will return true if the colors are visually equal to each other and false otherwise. The examples below compare the foreground color to the background color. AS: if equal colors foreground color with background color then VB: If (appRef.ForegroundColor.IsEqual(appRef.BackgroundColor)) Then JS: if (foregroundColor.isEqual(backgroundColor)) 3.14.4 Getting a Web Safe Color To convert a color to a web safe color use the web safe color command on AppleScript and the NearestWebColor/nearestWebColor property on the SolidColor object for Visual Basic and JavaScript. The web safe color returned is an RGB color. AS: set myWebSafeColor to web safe color for foreground color VB: Dim myWebSafeColor As Photoshop.RGBColor Set myWebSafeColor = appRef.ForegroundColor.NearestWebColor JS: var webSafeColor = new RGBColor(); webSafeColor = foregroundColor.nearestWebColor; Photoshop 7.0 Scripting Guide 79