From 30abd4cd3deb83fa0a09ea029ca46530c6de25be Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Tue, 27 Feb 2024 10:36:03 -0500 Subject: [PATCH 1/6] Add bevy_color prelude --- crates/bevy_color/src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/bevy_color/src/lib.rs b/crates/bevy_color/src/lib.rs index 0c1dca63d1bab..6148a5a27a84e 100644 --- a/crates/bevy_color/src/lib.rs +++ b/crates/bevy_color/src/lib.rs @@ -95,6 +95,21 @@ mod test_colors; mod testing; mod xyza; +/// Commonly used color types and traits. +pub mod prelude { + pub use crate::color::*; + pub use crate::color_ops::*; + pub use crate::hsla::*; + pub use crate::hsva::*; + pub use crate::hwba::*; + pub use crate::laba::*; + pub use crate::lcha::*; + pub use crate::linear_rgba::*; + pub use crate::oklaba::*; + pub use crate::srgba::*; + pub use crate::xyza::*; +} + pub use color::*; pub use color_ops::*; pub use color_range::*; From faa6bc40772d22696b5c3f6ec6f532f28df9086c Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Tue, 27 Feb 2024 10:41:41 -0500 Subject: [PATCH 2/6] Add bevy_color to bevy_internal --- crates/bevy_internal/Cargo.toml | 1 + crates/bevy_internal/src/lib.rs | 6 ++++++ crates/bevy_internal/src/prelude.rs | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/crates/bevy_internal/Cargo.toml b/crates/bevy_internal/Cargo.toml index c58c910e69caa..e1ddca37fd52c 100644 --- a/crates/bevy_internal/Cargo.toml +++ b/crates/bevy_internal/Cargo.toml @@ -185,6 +185,7 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.14.0-dev" } bevy_animation = { path = "../bevy_animation", optional = true, version = "0.14.0-dev" } bevy_asset = { path = "../bevy_asset", optional = true, version = "0.14.0-dev" } bevy_audio = { path = "../bevy_audio", optional = true, version = "0.14.0-dev" } +bevy_color = { path = "../bevy_color", optional = true, version = "0.14.0-dev" } bevy_core_pipeline = { path = "../bevy_core_pipeline", optional = true, version = "0.14.0-dev" } bevy_gltf = { path = "../bevy_gltf", optional = true, version = "0.14.0-dev" } bevy_pbr = { path = "../bevy_pbr", optional = true, version = "0.14.0-dev" } diff --git a/crates/bevy_internal/src/lib.rs b/crates/bevy_internal/src/lib.rs index 1d628a41575e4..02a3440d1aa98 100644 --- a/crates/bevy_internal/src/lib.rs +++ b/crates/bevy_internal/src/lib.rs @@ -27,6 +27,12 @@ pub mod core { pub use bevy_core::*; } +#[cfg(feature = "bevy_color")] +pub mod color { + //! Shared color types and operations. + pub use bevy_color::*; +} + pub mod diagnostic { //! Useful diagnostic plugins and types for bevy apps. pub use bevy_diagnostic::*; diff --git a/crates/bevy_internal/src/prelude.rs b/crates/bevy_internal/src/prelude.rs index f9243382a11ef..aa256727810da 100644 --- a/crates/bevy_internal/src/prelude.rs +++ b/crates/bevy_internal/src/prelude.rs @@ -19,6 +19,10 @@ pub use crate::audio::prelude::*; #[cfg(feature = "bevy_animation")] pub use crate::animation::prelude::*; +#[doc(hidden)] +#[cfg(feature = "bevy_color")] +pub use crate::color::prelude::*; + #[doc(hidden)] #[cfg(feature = "bevy_core_pipeline")] pub use crate::core_pipeline::prelude::*; From 08a61a0a78c0b2da44a7c4f0ca2d1d9a1334040e Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Tue, 27 Feb 2024 11:21:56 -0500 Subject: [PATCH 3/6] Add bevy_color to root crate Cargo.toml --- Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index f540153fc86d5..115c4354434c5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,6 +56,7 @@ default = [ "animation", "bevy_asset", "bevy_audio", + "bevy_color", "bevy_gilrs", "bevy_scene", "bevy_winit", @@ -91,6 +92,9 @@ bevy_asset = ["bevy_internal/bevy_asset"] # Provides audio functionality bevy_audio = ["bevy_internal/bevy_audio"] +# Provides shared color types and operations +bevy_color = ["bevy_internal/bevy_color"] + # Provides cameras and other basic render pipeline features bevy_core_pipeline = [ "bevy_internal/bevy_core_pipeline", From 474ea278e8d0b85f9376defd4b4624b3c0218a36 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Tue, 27 Feb 2024 11:28:04 -0500 Subject: [PATCH 4/6] Add bevy_color feature to more high-level features --- Cargo.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 115c4354434c5..e92945da3a2fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,7 +84,7 @@ default = [ dynamic_linking = ["dep:bevy_dylib", "bevy_internal/dynamic_linking"] # Provides animation functionality -bevy_animation = ["bevy_internal/bevy_animation"] +bevy_animation = ["bevy_internal/bevy_animation", "bevy_color"] # Provides asset functionality bevy_asset = ["bevy_internal/bevy_asset"] @@ -120,7 +120,7 @@ bevy_pbr = [ ] # Provides rendering functionality -bevy_render = ["bevy_internal/bevy_render"] +bevy_render = ["bevy_internal/bevy_render", "bevy_color"] # Provides scene functionality bevy_scene = ["bevy_internal/bevy_scene", "bevy_asset"] @@ -137,13 +137,14 @@ bevy_ui = [ "bevy_core_pipeline", "bevy_text", "bevy_sprite", + "bevy_color", ] # winit window and input backend bevy_winit = ["bevy_internal/bevy_winit"] # Adds support for rendering gizmos -bevy_gizmos = ["bevy_internal/bevy_gizmos"] +bevy_gizmos = ["bevy_internal/bevy_gizmos", "bevy_color"] # Tracing support, saving a file in Chrome Tracing format trace_chrome = ["trace", "bevy_internal/trace_chrome"] From afb095861f6b323d2a0059897e8575c188ed9301 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Tue, 27 Feb 2024 11:39:29 -0500 Subject: [PATCH 5/6] Re-generate feature descriptions --- docs/cargo_features.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/cargo_features.md b/docs/cargo_features.md index c3dfba74fe799..388d8a94af65c 100644 --- a/docs/cargo_features.md +++ b/docs/cargo_features.md @@ -16,6 +16,7 @@ The default feature set enables most of the expected features of a game engine, |bevy_animation|Provides animation functionality| |bevy_asset|Provides asset functionality| |bevy_audio|Provides audio functionality| +|bevy_color|Provides shared color types and operations| |bevy_core_pipeline|Provides cameras and other basic render pipeline features| |bevy_debug_stepping|Enable stepping-based debugging of Bevy systems| |bevy_gilrs|Adds gamepad support| From 23671a5c572f04ac73c1668d44586dc36d2db9c0 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Tue, 27 Feb 2024 11:55:06 -0500 Subject: [PATCH 6/6] Add to bevy_sprite as well --- Cargo.toml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e92945da3a2fb..05de917b8a682 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -126,7 +126,12 @@ bevy_render = ["bevy_internal/bevy_render", "bevy_color"] bevy_scene = ["bevy_internal/bevy_scene", "bevy_asset"] # Provides sprite functionality -bevy_sprite = ["bevy_internal/bevy_sprite", "bevy_render", "bevy_core_pipeline"] +bevy_sprite = [ + "bevy_internal/bevy_sprite", + "bevy_render", + "bevy_core_pipeline", + "bevy_color", +] # Provides text functionality bevy_text = ["bevy_internal/bevy_text", "bevy_asset", "bevy_sprite"]