From c765af2d2fbb64f669783191d5fabed62428d123 Mon Sep 17 00:00:00 2001 From: Gabriel Gheorghe Date: Fri, 13 Nov 2020 14:16:03 +0200 Subject: [PATCH 1/3] Add all basic color constants --- crates/bevy_render/src/color.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/crates/bevy_render/src/color.rs b/crates/bevy_render/src/color.rs index 40f7019c2277f..2ebb033a378bc 100644 --- a/crates/bevy_render/src/color.rs +++ b/crates/bevy_render/src/color.rs @@ -26,13 +26,44 @@ pub struct Color { unsafe impl Byteable for Color {} impl Color { + pub const ALICEBLUE: Color = Color::rgb_linear(0.94, 0.97, 1.0); + pub const ANTIQUEWHITE: Color = Color::rgb_linear(0.98, 0.92, 0.84); + pub const AQUAMARINE: Color = Color::rgb_linear(0.49, 1.0, 0.83); + pub const AZURE: Color = Color::rgb_linear(0.94, 1.0, 1.0); + pub const BEIGE: Color = Color::rgb_linear(0.96, 0.96, 0.86); + pub const BISQUE: Color = Color::rgb_linear(1.0, 0.89, 0.77); pub const BLACK: Color = Color::rgb_linear(0.0, 0.0, 0.0); pub const BLUE: Color = Color::rgb_linear(0.0, 0.0, 1.0); + pub const CRIMSON: Color = Color::rgb_linear(0.86, 0.08, 0.24); + pub const CYAN: Color = Color::rgb_linear(0.0, 1.0, 1.0); + pub const DARKGRAY: Color = Color::rgb_linear(0.25, 0.25, 0.25); + pub const DARKGREEN: Color = Color::rgb_linear(0.0, 0.5, 0.0); + pub const FUCHSIA: Color = Color::rgb_linear(1.0, 0.0, 1.0); + pub const GRAY: Color = Color::rgb_linear(0.5, 0.5, 0.5); pub const GREEN: Color = Color::rgb_linear(0.0, 1.0, 0.0); + pub const GOLD: Color = Color::rgb_linear(1.0, 0.84, 0.0); + pub const INDIGO: Color = Color::rgb_linear(0.29, 0.0, 0.51); + pub const LIMEGREEN: Color = Color::rgb_linear(0.2, 0.8, 0.2); + pub const MAROON: Color = Color::rgb_linear(0.5, 0.0, 0.0); + pub const MIDNIGHTBLUE: Color = Color::rgb_linear(0.1, 0.1, 0.44); + pub const NAVY: Color = Color::rgb_linear(0.0, 0.0, 0.5); pub const NONE: Color = Color::rgba_linear(0.0, 0.0, 0.0, 0.0); + pub const OLIVE: Color = Color::rgb_linear(0.5, 0.5, 0.0); + pub const ORANGE: Color = Color::rgb_linear(1.0, 0.65, 0.0); + pub const ORANGERED: Color = Color::rgb_linear(1.0, 0.27, 0.0); pub const PINK: Color = Color::rgb_linear(1.0, 0.08, 0.58); + pub const PURPLE: Color = Color::rgb_linear(0.5, 0.0, 0.5); pub const RED: Color = Color::rgb_linear(1.0, 0.0, 0.0); + pub const SALMON: Color = Color::rgb_linear(0.98, 0.5, 0.45); + pub const SEAGREEN: Color = Color::rgb_linear(0.18, 0.55, 0.34); + pub const SILVER: Color = Color::rgb_linear(0.75, 0.75, 0.75); + pub const TEAL: Color = Color::rgb_linear(0.0, 0.5, 0.5); + pub const TOMATO: Color = Color::rgb_linear(1.0, 0.39, 0.28); + pub const TURQUOISE: Color = Color::rgb_linear(0.25, 0.88, 0.82); + pub const VIOLET: Color = Color::rgb_linear(0.93, 0.51, 0.93); pub const WHITE: Color = Color::rgb_linear(1.0, 1.0, 1.0); + pub const YELLOW: Color = Color::rgb_linear(1.0, 1.0, 0.0); + pub const YELLOWGREEN: Color = Color::rgb_linear(0.6, 0.8, 0.2); // TODO: cant make rgb and rgba const due traits not allowed in const functions // see issue #57563 /~https://github.com/rust-lang/rust/issues/57563 From 818488b782355637ff06df021533dfbb66f8e252 Mon Sep 17 00:00:00 2001 From: Gabriel Gheorghe Date: Fri, 13 Nov 2020 14:39:07 +0200 Subject: [PATCH 2/3] Fix Gold Color position --- crates/bevy_render/src/color.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_render/src/color.rs b/crates/bevy_render/src/color.rs index 2ebb033a378bc..1ffcd492bf3d6 100644 --- a/crates/bevy_render/src/color.rs +++ b/crates/bevy_render/src/color.rs @@ -39,9 +39,9 @@ impl Color { pub const DARKGRAY: Color = Color::rgb_linear(0.25, 0.25, 0.25); pub const DARKGREEN: Color = Color::rgb_linear(0.0, 0.5, 0.0); pub const FUCHSIA: Color = Color::rgb_linear(1.0, 0.0, 1.0); + pub const GOLD: Color = Color::rgb_linear(1.0, 0.84, 0.0); pub const GRAY: Color = Color::rgb_linear(0.5, 0.5, 0.5); pub const GREEN: Color = Color::rgb_linear(0.0, 1.0, 0.0); - pub const GOLD: Color = Color::rgb_linear(1.0, 0.84, 0.0); pub const INDIGO: Color = Color::rgb_linear(0.29, 0.0, 0.51); pub const LIMEGREEN: Color = Color::rgb_linear(0.2, 0.8, 0.2); pub const MAROON: Color = Color::rgb_linear(0.5, 0.0, 0.0); From 0a5df4a708964c503b60f7fcb897521ae2db1e5f Mon Sep 17 00:00:00 2001 From: Gabriel Gheorghe Date: Sun, 15 Nov 2020 22:03:55 +0200 Subject: [PATCH 3/3] Rustify color names --- crates/bevy_render/src/color.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/bevy_render/src/color.rs b/crates/bevy_render/src/color.rs index 1ffcd492bf3d6..52c3714f44bf1 100644 --- a/crates/bevy_render/src/color.rs +++ b/crates/bevy_render/src/color.rs @@ -26,8 +26,8 @@ pub struct Color { unsafe impl Byteable for Color {} impl Color { - pub const ALICEBLUE: Color = Color::rgb_linear(0.94, 0.97, 1.0); - pub const ANTIQUEWHITE: Color = Color::rgb_linear(0.98, 0.92, 0.84); + pub const ALICE_BLUE: Color = Color::rgb_linear(0.94, 0.97, 1.0); + pub const ANTIQUE_WHITE: Color = Color::rgb_linear(0.98, 0.92, 0.84); pub const AQUAMARINE: Color = Color::rgb_linear(0.49, 1.0, 0.83); pub const AZURE: Color = Color::rgb_linear(0.94, 1.0, 1.0); pub const BEIGE: Color = Color::rgb_linear(0.96, 0.96, 0.86); @@ -36,26 +36,26 @@ impl Color { pub const BLUE: Color = Color::rgb_linear(0.0, 0.0, 1.0); pub const CRIMSON: Color = Color::rgb_linear(0.86, 0.08, 0.24); pub const CYAN: Color = Color::rgb_linear(0.0, 1.0, 1.0); - pub const DARKGRAY: Color = Color::rgb_linear(0.25, 0.25, 0.25); - pub const DARKGREEN: Color = Color::rgb_linear(0.0, 0.5, 0.0); + pub const DARK_GRAY: Color = Color::rgb_linear(0.25, 0.25, 0.25); + pub const DARK_GREEN: Color = Color::rgb_linear(0.0, 0.5, 0.0); pub const FUCHSIA: Color = Color::rgb_linear(1.0, 0.0, 1.0); pub const GOLD: Color = Color::rgb_linear(1.0, 0.84, 0.0); pub const GRAY: Color = Color::rgb_linear(0.5, 0.5, 0.5); pub const GREEN: Color = Color::rgb_linear(0.0, 1.0, 0.0); pub const INDIGO: Color = Color::rgb_linear(0.29, 0.0, 0.51); - pub const LIMEGREEN: Color = Color::rgb_linear(0.2, 0.8, 0.2); + pub const LIME_GREEN: Color = Color::rgb_linear(0.2, 0.8, 0.2); pub const MAROON: Color = Color::rgb_linear(0.5, 0.0, 0.0); - pub const MIDNIGHTBLUE: Color = Color::rgb_linear(0.1, 0.1, 0.44); + pub const MIDNIGHT_BLUE: Color = Color::rgb_linear(0.1, 0.1, 0.44); pub const NAVY: Color = Color::rgb_linear(0.0, 0.0, 0.5); pub const NONE: Color = Color::rgba_linear(0.0, 0.0, 0.0, 0.0); pub const OLIVE: Color = Color::rgb_linear(0.5, 0.5, 0.0); pub const ORANGE: Color = Color::rgb_linear(1.0, 0.65, 0.0); - pub const ORANGERED: Color = Color::rgb_linear(1.0, 0.27, 0.0); + pub const ORANGE_RED: Color = Color::rgb_linear(1.0, 0.27, 0.0); pub const PINK: Color = Color::rgb_linear(1.0, 0.08, 0.58); pub const PURPLE: Color = Color::rgb_linear(0.5, 0.0, 0.5); pub const RED: Color = Color::rgb_linear(1.0, 0.0, 0.0); pub const SALMON: Color = Color::rgb_linear(0.98, 0.5, 0.45); - pub const SEAGREEN: Color = Color::rgb_linear(0.18, 0.55, 0.34); + pub const SEA_GREEN: Color = Color::rgb_linear(0.18, 0.55, 0.34); pub const SILVER: Color = Color::rgb_linear(0.75, 0.75, 0.75); pub const TEAL: Color = Color::rgb_linear(0.0, 0.5, 0.5); pub const TOMATO: Color = Color::rgb_linear(1.0, 0.39, 0.28); @@ -63,7 +63,7 @@ impl Color { pub const VIOLET: Color = Color::rgb_linear(0.93, 0.51, 0.93); pub const WHITE: Color = Color::rgb_linear(1.0, 1.0, 1.0); pub const YELLOW: Color = Color::rgb_linear(1.0, 1.0, 0.0); - pub const YELLOWGREEN: Color = Color::rgb_linear(0.6, 0.8, 0.2); + pub const YELLOW_GREEN: Color = Color::rgb_linear(0.6, 0.8, 0.2); // TODO: cant make rgb and rgba const due traits not allowed in const functions // see issue #57563 /~https://github.com/rust-lang/rust/issues/57563