@@ -124,6 +124,10 @@ impl Color {
124
124
Color :: RGBA ( r, g, b, a)
125
125
}
126
126
127
+ pub fn invert ( self ) -> Color {
128
+ Color :: RGBA ( 255 - self . r , 255 - self . g , 255 - self . b , 255 - self . a )
129
+ }
130
+
127
131
#[ inline]
128
132
pub const fn rgb ( self ) -> ( u8 , u8 , u8 ) {
129
133
( self . r , self . g , self . b )
@@ -139,6 +143,18 @@ impl Color {
139
143
const fn raw ( self ) -> sys:: SDL_Color {
140
144
sys:: SDL_Color { r : self . r , g : self . g , b : self . b , a : self . a }
141
145
}
146
+
147
+ pub const WHITE : Color = Color :: RGBA ( 255 , 255 , 255 , 255 ) ;
148
+ pub const BLACK : Color = Color :: RGBA ( 0 , 0 , 0 , 255 ) ;
149
+ pub const GRAY : Color = Color :: RGBA ( 128 , 128 , 128 , 255 ) ;
150
+ pub const GREY : Color = Color :: GRAY ;
151
+ pub const RED : Color = Color :: RGBA ( 255 , 0 , 0 , 255 ) ;
152
+ pub const GREEN : Color = Color :: RGBA ( 0 , 255 , 0 , 255 ) ;
153
+ pub const BLUE : Color = Color :: RGBA ( 0 , 0 , 255 , 255 ) ;
154
+ pub const MAGENTA : Color = Color :: RGBA ( 255 , 0 , 255 , 255 ) ;
155
+ pub const YELLOW : Color = Color :: RGBA ( 255 , 255 , 0 , 255 ) ;
156
+ pub const CYAN : Color = Color :: RGBA ( 0 , 255 , 255 , 255 ) ;
157
+
142
158
}
143
159
144
160
impl Into < sys:: SDL_Color > for Color {
0 commit comments