4 releases
0.16.0 |
|
---|---|
0.15.0 |
|
0.14.0 |
|
0.12.3 | Feb 7, 2024 |
#1979 in Game dev
63KB
1.5K
SLoC
Overview
bevy_color
is a library of methods to represent and manipulate color values in various
color spaces, compatible with the Bevy game engine.
Color space types:
Srgba
- Standard RGB color space.LinearRgba
- Linear RGB color space.Hsla
- Hue, Saturation, Lightness color space.Lcha
- Lightness, Chroma, Hue color space.Oklaba
- OKLab color space.
Other types:
ColorRepresentation
- an enum that can hold a color of any known type.ColorRange
- a range object that allows interpolation between a start and end color.AnyColorRange
- a type-erased color range that allows generating a gradient or interpolation in different color spaces, without exposing details about which color space is being used.
Common operations:
- All color spaces support conversions to and from
Srgba
viaInto
. - All color spaces support conversions to and from
LinearRgba
viaInto
. - Most color spaces support conversions to and from the Bevy legacy
Color
type. - Colors can be converted to raw representations such as
Vec4
for use as shader parameters. - All color spaces support the
Mix
trait, which providesmix
, a linear interpolation between colors, andmix_assign
, which is the mutating version ofmix
. - Convenient utility methods:
.lighter(amount)
.darker(amount)
.with_luminance(lum)
Dependencies
~22MB
~401K SLoC