The ColorVector class is used to represent a color. The rgb_color class is also used to represent colors, but ColorVector's are useful when you need to perform mathematical operations on colors.
The red component of the color. Values can range from 0 to 1.
The green component of the color. Values can range from 0 to 1.
The blue component of the color. Values can range from 0 to 1.
The alpha (or opacity) component of the color. Values can range from 0 to 1. An alpha of 0 is a totally transparent color, while a value of 1 indicates a totally opaque color.
Set the value of a color. This function is an alternative to setting the r, g, b and a values individually. If you leave out the a value, it will default to 1.0.
r (float): the r value you wish to set g (float): the g value you wish to set b (float): the b value you wish to set a (float): the a value you wish to set (defaults to 1.0) Return value: noneSet the value of a color by copying an existing color.
vec (rgb_color): an rgb_color object whose value you wish to copy Return value: noneSet the value of a color by copying an existing color.
vec (ColorVector): another ColorVector object whose value you wish to copy Return value: noneComputes the magnitude of a color vector.
Return value (float): the color's magnitude (length)Computes the squared magnitude of a color vector.
Return value (float): the color's squared magnitudeNormalizes a ColorVector. This process ensures that each of the r, g, b and a values is within the range 0 to 1.
Return value: noneInverts a color.
Return value: noneReturns true if a color is pure black, false otherwise.
Return value (bool): true if the color is pure black, false otherwiseReturns true if a color is pure white, false otherwise.
Return value (bool): true if the color is pure white, false otherwiseReturns true if a color is totally opaque, false otherwise.
Return value (bool): true if the color is totally opaque, false otherwiseReturns true if a color is totally transparent, false otherwise.
Return value (bool): true if the color is totally transparent, false otherwiseConverts a ColorVector into an rgb_color object, returning the new object.
Return value (rgb_color): a new rgb_color object with the equivalent color values as the original ColorVectorAdds two colors and returns the result as a new color. This operator makes it possible to add two colors as if they were regular numbers. Example: c = a + b.
color (ColorVector): a color to add to the first one Return value (ColorVector): the sum of two colorsSubtracts one color from another and returns the result as a new color. This operator makes it possible to subtract colors as if they were regular numbers. Example: c = a - b.
color (ColorVector): a color to subtract from the first one Return value (ColorVector): the difference of two colorsMultiplies one color by another and returns the result as a new color. This operator makes it possible to multiply colors as if they were regular numbers. Example: c = a * b.
color (ColorVector): a color to multiply by the first one Return value (ColorVector): the result of mutliplying two colorsMultiplies a color by a number, returning the result as a new color. Example: c2 = c * 3.
num (float): a number to multiply the color by Return value (ColorVector): the original color, multiplied by the number "num"Divides a color by a number, returning the result as a new color. Example: c2 = c / 3.
num (float): a number to divide the color by Return value (ColorVector): the original color, divided by the number "num"