dsfml.graphics.color

$(U Color) is a simple color class composed of 4 components:

  • Red
  • Green
  • Blue
  • Alpha (opacity)

Each component is a public member, an unsigned integer in the range [0, 255]. Thus, colors can be constructed and manipulated very easily:

auto color = Color(255, 0, 0); // red
color.r = 0;                // make it black
color.b = 128;              // make it dark blue

$(PARA The fourth component of colors, named "alpha", represents the opacity of the color. A color with an alpha value of 255 will be fully opaque, while an alpha value of 0 will make a color fully transparent, whatever the value of the other components is. The most common colors are already defined as static variables:)

1 auto black       = Color.Black;
2 auto white       = Color.White;
3 auto red         = Color.Red;
4 auto green       = Color.Green;
5 auto blue        = Color.Blue;
6 auto yellow      = Color.Yellow;
7 auto magenta     = Color.Magenta;
8 auto cyan        = Color.Cyan;
9 auto transparent = Color.Transparent;

$(PARA Colors can also be added and modulated (multiplied) using the overloaded operators `+` and `*`.)

Members

Structs

Color
struct Color

Color is a utility struct for manipulating 32-bits RGBA colors.

Meta