lovr.math.linearToGamma

Converts a color from linear space to gamma space.


gr, gg, gb = lovr.math.linearToGamma(lr, lg, lb)

Arguments

NameTypeDescription
lrnumber The red component of the linear-space color.
lgnumber The green component of the linear-space color.
lbnumber The blue component of the linear-space color.

Returns

NameTypeDescription
grnumber The red component of the resulting gamma-space color.
ggnumber The green component of the resulting gamma-space color.
gbnumber The blue component of the resulting gamma-space color.

A table can also be used.

gr, gg, gb = lovr.math.linearToGamma(color)

Arguments

NameTypeDescription
colortable A table containing the components of a linear-space color.

Returns

NameTypeDescription
grnumber The red component of the resulting gamma-space color.
ggnumber The green component of the resulting gamma-space color.
gbnumber The blue component of the resulting gamma-space color.

Convert a single color channel.

y = lovr.math.linearToGamma(x)

Arguments

NameTypeDescription
xnumber The color channel to convert.

Returns

NameTypeDescription
ynumber The converted color channel.

See also