*! version 1.0.0 21MAR2016

Interpolation of colors between starting and ending color values.

help for brewterpolate

brewterpolate -- Stata program to interpolate an arbitrary number of
colors between a starting and ending color.

Syntax

brewterpolate, scolor(string)
ecolor(string) colors(int)
[cmod(string) icspace(string)
rcspace(string) inverse grayscale ]

Description

brewterpolate is a program used to interpolate color values between
the start and end colors for an arbitrary number of points. The program can
accept input in several formats and provides output in rgb, rgba, srgb, srgba,
hsv, and hsva formats.

Options

scolor is a required argument that takes a value conforming to
one of the formats listed in Input Color Spaces.

scolor is a required argument that takes a value conforming to
one of the formats listed in Input Color Spaces.

colors is a required argument that takes a value to define the
number of points between the starting and ending colors to interpolate.

cmod is an optional argument that can take one of the
following values: brighter, darker, saturated, desaturated, or nothing and is
used to modify the interpolated colors. A value of "brighter" will return
colors that are arbitrarily brighter than the normal interpolated value,
"darker" will return colors that are arbitrarily darker than the normal
interpolated colors, "saturated" will return arbitrarily more saturated colors,
and "desaturated" will return arbitrarily less saturated colors. If no argument
is passed to this parameter, the colors are interpolated without modification.

icspace is an optional argument used to specify the input color
space used for the starting and ending colors. If no argument is passed, RGB is
assumed.

rcspace is an optional argument used to specify the return color
space used for passing the interpolated colors back to Stata. This can be any
of the values listed in Input Color Spaces except
for the web-based formats.

inverse is an optional argument used to return the inverse of
the interpolated colors. This is implemented after any of the luminance modifications
have been made to the colors.

grayscale is an optional argument used to force the returned
color values into a grayscale. This is the last transformation that is applied
to the colors. In other words, if you requested the inverse of the colors that
are arbitrarily less saturated, the method would first get the less saturated
interpolated color, invert it, and then transform it to a gray scale value.

Argument Input Colorspace

rgb Red, Green, Blue (ex., 0 0 255).
rgba Red, Green, Blue, Alpha (ex., 0 0 255 0.5)
srgb RGB Decimal (ex., 0.0 0.0 1.0).
srgba RGB Decimal (ex., 0.0 0.0 1.0 0.5).
hsb Hue, Saturation, Brightness (ex., 270.0 1.0 1.0)
hsba Hue, Saturation, Brightness (ex., 270.0 1.0 1.0 0.5)
web Hex string (ex., 0000FF) [returned with leading # added]
weba Hex string w/Decimal Alpha (ex., 0000FF .27) [returned with leading # added]
weba Hex string w/Hex Alpha (ex., 0000FF00) [returned with leading # added]
hex Hexadecimal (ex., 0000FF)
hexa Hexadecimal w/Alpha (ex., 0000FF 0.5)
hexa Hex w/Alpha scaled as RGB Integer (e.g., 0000FFFF)
hexa web Web Hexadecimal w/Alpha (ex., )
rgb web Web RGB (ex., )
rgba web Web RGB w/Alpha (ex., )
srgb Web sRGB (ex., )
srgba Web sRGB w/Alpha (ex., )
hsl Hue, Saturation, Lightness (ex., hex, rgb, hsl)
hsla Hue, Saturation, Lightness w/Alpha (ex., hex, rgb, hsl)

Examples

brewterpolate, sc("197 115 47") ec("5, 37, 249") c(4)

brewterpolate, sc("197 115 47") ec("5, 37, 249") c(9) inv

brewterpolate, sc("197 115 47") ec("5, 37, 249") c(3) g

brewterpolate, sc("197 115 47") ec("5, 37, 249") c(5) rcs(web) cm(saturated)

brewterpolate, sc("197 115 47") ec("5, 37, 249") c(5) rcs(hexa) cm(desaturated)

brewterpolate, sc("197 115 47") ec("5, 37, 249") c(18) rcs(hsb)

brewterpolate, sc("197 115 47") ec("5, 37, 249") c(37) inv cm(brighter) rcs(hsb)

References

Java Color Documentation

Author

William R. Buchanan, Ph.D.

Data Scientist

Minneapolis Public Schools

William.Buchanan at mpls [dot] k12 [dot] mn [dot] us