1 /**
2  * Color
3  */
4 module d2d.sdl2.Color;
5 
6 import d2d.sdl2;
7 
8 /**
9  * A color struct
10  * As of right now, only works with additive RGBA, but may work with other formats later
11  * Additive RGBA is where the color is stored as an addition of red, green, and blue
12  * Alpha is the transparency of the color
13  */
14 struct Color {
15     ubyte r; ///Red value for the color
16     ubyte g; ///Green value for the color
17     ubyte b; ///Blue value for the color
18     ubyte a = 255; ///Alpha value or transparency for the color
19     private SDL_Color sdlColor;
20 
21     /**
22      * Gets the color as an SDL_Color
23      */
24     @property SDL_Color* handle() {
25         sdlColor = SDL_Color(r, g, b, a);
26         return &sdlColor;
27     }
28 }
29 
30 /**
31  * A list of pre-defined common colors
32  */
33 enum PredefinedColor {
34     RED = Color(255, 0, 0),
35     GREEN = Color(0, 255, 0),
36     BLUE = Color(0, 0, 255),
37     YELLOW = Color(255, 255, 0),
38     MAGENTA = Color(255, 0, 255),
39     CYAN = Color(0,
40             255, 255),
41     WHITE = Color(255, 255, 255),
42     PINK = Color(255, 125, 255),
43     ORANGE = Color(255, 125, 0),
44     LIGHTGREY = Color(175, 175, 175),
45     DARKGREY = Color(75, 75, 75),
46     BLACK = Color(0, 0, 0)
47 }