dsfml.graphics.color

$(U Color) is a simple color structure 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:)

auto black       = Color.Black;
auto white       = Color.White;
auto red         = Color.Red;
auto green       = Color.Green;
auto blue        = Color.Blue;
auto yellow      = Color.Yellow;
auto magenta     = Color.Magenta;
auto cyan        = Color.Cyan;
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