Color

Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam quis risus eget urna mollis ornare vel eu leo. Aenean lacinia bibendum nulla sed consectetur. Maecenas sed diam eget risus varius blandit sit amet non magna.

Color Functions

Here’s a script example that creates a green circle (in the RGB color space) with a 50% transparency (alpha value) overlaid on a blue square:

green-circle-blue-square
cnvs = document.windows[0].selection.canvas square = cnvs.addShape('Square',new Rect(72,72,200,200)) square.fillColor = Color.RGB(0, 0, 1, 1) circle = cnvs.addShape('Circle',new Rect(150,150,200,200)) circle.fillColor = Color.RGB(0, 1, 0, 0.5)
omnigraffle:///omnijs-run?script=cnvs%20%3D%20document%2Ewindows%5B0%5D%2Eselection%2Ecanvas%0Asquare%20%3D%20cnvs%2EaddShape%28%27Square%27%2Cnew%20Rect%2872%2C72%2C200%2C200%29%29%0Asquare%2EfillColor%20%3D%20Color%2ERGB%280%2C%200%2C%201%2C%201%29%0Acircle%20%3D%20cnvs%2EaddShape%28%27Circle%27%2Cnew%20Rect%28150%2C150%2C200%2C200%29%29%0Acircle%2EfillColor%20%3D%20Color%2ERGB%280%2C%201%2C%200%2C%200%2E5%29

Here’s a script example that adds grayscale tint swatches, from black to white in increments of 10%, to the current canvas:

cnvs = document.windows[0].selection.canvas objSize = 48 offset = 0 swatches = new Array() for(i = 0; i < 11; i++){ offset = offset + objSize aRect = new Rect(offset, objSize, objSize, objSize) graphic = cnvs.addShape('Square', aRect) color = Color.White(i*.1,1) graphic.fillColor = color swatches.push(graphic) } swatchStrip = new Group(swatches)
omnigraffle:///omnijs-run?script=cnvs%20%3D%20document%2Ewindows%5B0%5D%2Eselection%2Ecanvas%0AobjSize%20%3D%2048%0Aoffset%20%3D%200%0Aswatches%20%3D%20new%20Array%28%29%0Afor%28i%20%3D%200%3B%20i%20%3C%2011%3B%20i%2B%2B%29%7B%0A%09offset%20%3D%20offset%20%20%2B%20objSize%0A%09aRect%20%3D%20new%20Rect%28offset%2C%20objSize%2C%20objSize%2C%20objSize%29%0A%09graphic%20%3D%20cnvs%2EaddShape%28%27Square%27%2C%20aRect%29%0A%09color%20%3D%20Color%2EWhite%28i*%2E1%2C1%29%0A%09graphic%2EfillColor%20%3D%20color%0A%09swatches%2Epush%28graphic%29%0A%7D%0AswatchStrip%20%3D%20new%20Group%28swatches%29
grayscale-swatches

Color Class Properties

Some common colors can be represented with the following property values instead of using one of the Color methods.

Color Instance Properties

Once a Color object has been created, you can use the following instance properties to gather information about the color object.

Color Instance Functions

Color objects can be blended to create new colors, using the blend() method:

cnvs = document.windows[0].selection.canvas graphic = cnvs.addShape('Circle',new Rect(0,0,200,200)) colorA = Color.red colorB = Color.yellow blendColor = colorA.blend(colorB,0.5) graphic.fillColor = blendColor
omnigraffle:///omnijs-run?script=cnvs%20%3D%20document%2Ewindows%5B0%5D%2Eselection%2Ecanvas%0Agraphic%20%3D%20cnvs%2EaddShape%28%27Circle%27%2Cnew%20Rect%280%2C0%2C200%2C200%29%29%0AcolorA%20%3D%20Color%2Ered%0AcolorB%20%3D%20Color%2Eyellow%0AblendColor%20%3D%20colorA%2Eblend%28colorB%2C0%2E5%29%0Agraphic%2EfillColor%20%3D%20blendColor

Here’s an example of blending colors: creating an orange circle by blending red and yellow

 

ColorSpace

Curabitur blandit tempus porttitor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec ullamcorper nulla non metus auctor fringilla. Etiam porta sem malesuada magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.

UNDER CONSTRUCTION

This webpage is in the process of being developed. Any content may change and may not be accurate or complete at this time.

DISCLAIMER