Adjust Color

The Adjust Color verb can be used to adjust the brightness of an HTML color string. It takes a starting color and some number of adjustments as parameters and returns a new HTML color string with the new color in standard HTML color format “RRGGBB”

The only adjustment currently supported is for brightness. You can adjust the brightness absolutely or relatively.

Brightness

The optional brightness parameter is for absolute color adjustment. It takes a decimal number between 0 and 1 with 1 being full brightness and 0 being black.

Brightness By

The optional brightness by parameter is for relative adjustments of color. To brighten a color pass a positive decimal number between 0 and 1. To darken a color pass a negative value between 0 and 1. You cannot brighten a color more than 1 nor darken it to less than 0 but it doesn’t hurt to pass values that would result in that. The color will just be fully bright or fully black as a result.

Usage:

Absolute setting of a pure red color to 50% brightness.

set myColorString to adjust color “FF0000” brightness 0.5

Making a slightly darker version of a yellow

set myColorString to adjust color “FFAA22” brightness by -0.25

History:

  • Added to XTension in version 9.3.2
dictionary/color/adjustcolor.txt · Last modified: 2017/07/08 15:51 by James Sentman
CC Attribution-No Derivative Works 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0