ANNOUNCE: Cocoa Scripting Course #7, NSColor

I wrote new ebook about Script Bundle (in Japanese). PDF 478 pages.

This is the seventh book in the Cocoa Scripting series. This is a manual for those who want to do color-related processing with AppleScript. This is about “color” that cannot be avoided in image processing and RTF processing.

The concept of color processing is rather unique, and if you know about color space, color handling, color difference (ΔE), brightness calculation, etc., you can say, “That’s what it is”, but if you don’t know it, you won’t understand it at all.

Even in the case of reading and processing the information of the color setting on a trivial OS from the plist, there are users who have set CMYK colors and Grayscale colors in the syntax color coding settings of the script editor, which everyone thought “Normally, you only set the color of RGB values”, and I have many good memories of having to deal with various things in a hurry.

Get started today with a parade of things that will help you right away, such as exporting Adobe Swatch Exchange files, listing frequent colors, calculating approximate colors, calculating color differences, and more. You will surely enjoy it.

Table of contents

Chapter 1: Introduction
Chapter 2 Practice
Chapter 3 NSColor Basic

Positioning and Role of Color Data
NSColor Basic Samples
NSColorList Basic Samples
NSColorSpace Basic Samples

Chapter 4 Color Processing Basics

How to use the color picker displayed by the choose color command
Create an NSColor with the RGB color specified by the choose color command
Color preview of RGB values written on Numbers documents
Retrieving each element of RGBA from NSColor
Convert RGB colors to HSBA colors
Get each element of HSBA from NSColor
Get the color space name from NSColor
Get the name of the color registered in the pencil (crayon) picker

Chapter 5 Color Processing Advanced Edition

Get brightness information from color
Get the color information of the pixels at the specified coordinates of the image
Reading AppleScript syntax coloring formatting information
Handling HTML color codes
Create a CIColor to run the CoreImage filter
Rough color judgment (color domain processing)
Calculate the color difference (ΔE)
Estimate color names (dbColNamesKit)
Color Posterization
Extraction of frequent colors (ColorCube)
Composite of two colors
Get the color with the brightness set to MAX (Colours)
Adobe Swatch Exchange File Creation
Image whitespace judgment
Attached sample Script introduction


AppleScript instructions related to Cocoa Scripting
Cocoa Scripting and Script Objects
AppleScript Droplet
Calling third-party frameworks and AppleScript Libraries
AppleScript mini reference
AppleScript Runtime Environments and Related Tools
List of AppleScript Reserved Words
Error Code Table
Assessment Assessment
Afterword, colophon