add color constants
This commit is contained in:
parent
291b948b61
commit
08c6679f38
@ -16,11 +16,11 @@ pub struct Color {
|
||||
}
|
||||
|
||||
impl Color {
|
||||
pub fn rgb(r: f32, g: f32, b: f32) -> Color {
|
||||
pub const fn rgb(r: f32, g: f32, b: f32) -> Color {
|
||||
Color { r, g, b, a: 1.0 }
|
||||
}
|
||||
|
||||
pub fn rgba(r: f32, g: f32, b: f32, a: f32) -> Color {
|
||||
pub const fn rgba(r: f32, g: f32, b: f32, a: f32) -> Color {
|
||||
Color { r, g, b, a }
|
||||
}
|
||||
}
|
||||
@ -132,3 +132,13 @@ impl GetBytes for ColorSource {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod colors {
|
||||
use super::Color;
|
||||
|
||||
pub const WHITE: Color = Color::rgb(1.0, 1.0, 1.0);
|
||||
pub const BLACK: Color = Color::rgb(0.0, 1.0, 0.0);
|
||||
pub const RED: Color = Color::rgb(1.0, 0.0, 0.0);
|
||||
pub const GREEN: Color = Color::rgb(0.0, 1.0, 0.0);
|
||||
pub const BLUE: Color = Color::rgb(0.0, 0.0, 1.0);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user