Class LM_ColorVector

Version added: before 9.5
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.

To create a variable of this class, use the following method:
local vc1 = LM.ColorVector:new_local()

Methods:

Name Returns Description Version added
AsColorStruct rgb_color Converts a ColorVector into an rgb_color object, returning the new object before 9.5
Invert void Inverts a color before 9.5
IsBlack bool Returns true if a color is pure black, false otherwise before 9.5
IsOpaque bool Returns true if a color is totally opaque, false otherwise before 9.5
IsTransparent bool Returns true if a color is totally transparent, false otherwise before 9.5
IsWhite bool Returns true if a color is pure white, false otherwise before 9.5
Mag real Computes the magnitude of a color vector before 9.5
Normalize void Normalizes a ColorVector before 9.5
operator* LM_ColorVector Multiplies one color by another and returns the result as a new color before 9.5
operator* LM_ColorVector Multiplies a color by a number, returning the result as a new color before 9.5
operator/ LM_ColorVector Divides a color by a number, returning the result as a new color before 9.5
operator‑ LM_ColorVector Subtracts one color from another and returns the result as a new color before 9.5
operator+ LM_ColorVector Adds two colors and returns the result as a new color before 9.5
Set void Set the value of a color by r, g and b before 9.5
Set void Set the value of a color by r, g, b and a before 9.5
Set void Set the value of a color by copying an existing rgb_color before 9.5
Set void Set the value of a color by copying an existing LM_ColorVector before 9.5
SquaredMag real Computes the squared magnitude of a color vector before 9.5

Properties:

Name Type Description Version added
r real The red component of the color. Values can range from 0 to 1. before 9.5
g real The green component of the color. Values can range from 0 to 1. before 9.5
b real The blue component of the color. Values can range from 0 to 1. before 9.5
a real 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. before 9.5