Comparing Colors - Adobe 23101335 - Photoshop - PC Manual

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

Advertisement

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:
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
if (foregroundColor.isEqual(backgroundColor))
Scripting Photoshop
Color objects
3
79

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop 7.0

Table of Contents