lovr.math.linearToGamma

Converts a color from linear space to gamma space.

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

Arguments

NameTypeDescription
lrnumberThe red component of the linear-space color.
lgnumberThe green component of the linear-space color.
lbnumberThe blue component of the linear-space color.

Returns

NameTypeDescription
grnumberThe red component of the resulting gamma-space color.
ggnumberThe green component of the resulting gamma-space color.
gbnumberThe blue component of the resulting gamma-space color.

A table can also be used.

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

Arguments

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

Returns

NameTypeDescription
grnumberThe red component of the resulting gamma-space color.
ggnumberThe green component of the resulting gamma-space color.
gbnumberThe blue component of the resulting gamma-space color.

Convert a single color channel.

y = lovr.math.linearToGamma(x)

Arguments

NameTypeDescription
xnumberThe color channel to convert.

Returns

NameTypeDescription
ynumberThe converted color channel.

See also