Skip to content
Maximilian Stadlmeier edited this page Jul 17, 2014 · 7 revisions

RUL.RulCol

RUL offers a variety of functions for generating random colors. Depending on which framework you are using this library with, the names of functions and types of parameters may differ slightly.
Keep in mind that Unity colors use the floating point [0-1] instead of the more common integer[0-255] range for their argb components.

Col RandColor()

Returns a completely random, opaque color

Col RandColor(int lightness)

lightness : _Lightness between 0 and 255
Returns a random, opaque color with the specified lightness

Col RandColor(Col baseColor, float maxRelativeVariance)

baseColor : The base for the random color
maxRelativeVariance : A value between 0 and 1 specifying the maximum variance from the base color's RGB components
Returns a color that looks similar to the specified base color. maxRelativeVariance determines how much the randomized color may differ from the original

Col RandColor(Hues hue, LuminosityTypes luminosity)

hue : The approximate hue of the random color
*luminosity : The approximate luminosity of the random color
Returns a color with the specified hue and luminosity

Col RandColor(Hues hue)

hue : The approximate hue of the random color
Returns a color with the specified hue and a random luminosity

Col RandColorBetween(Col colA, Col colB)

colA _The first color _
colB The second color
Returns a color that is randomly interpolated between the given colors
Example : RandColorBetween(new Col(0,0,0), new Col(255,255,255)) will return a random monochrome color.