From ac56d671f44d724962fba893e1bf3fe24477ec30 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Tue, 27 Feb 2024 19:41:58 -0500 Subject: [PATCH] Fix color constants in gizmo docs tests --- crates/bevy_gizmos/src/arcs.rs | 5 +-- crates/bevy_gizmos/src/arrows.rs | 9 ++++-- crates/bevy_gizmos/src/circles.rs | 20 +++++++----- crates/bevy_gizmos/src/gizmos.rs | 53 ++++++++++++++++++++----------- crates/bevy_gizmos/src/lib.rs | 3 +- 5 files changed, 57 insertions(+), 33 deletions(-) diff --git a/crates/bevy_gizmos/src/arcs.rs b/crates/bevy_gizmos/src/arcs.rs index 72f7b7bf665763..f53c6cfefb49fa 100644 --- a/crates/bevy_gizmos/src/arcs.rs +++ b/crates/bevy_gizmos/src/arcs.rs @@ -29,13 +29,14 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; /// # use std::f32::consts::PI; + /// # use bevy_color::palettes::basic::{GREEN, RED}; /// fn system(mut gizmos: Gizmos) { - /// gizmos.arc_2d(Vec2::ZERO, 0., PI / 4., 1., Color::GREEN); + /// gizmos.arc_2d(Vec2::ZERO, 0., PI / 4., 1., GREEN); /// /// // Arcs have 32 line-segments by default. /// // You may want to increase this for larger arcs. /// gizmos - /// .arc_2d(Vec2::ZERO, 0., PI / 4., 5., Color::RED) + /// .arc_2d(Vec2::ZERO, 0., PI / 4., 5., RED) /// .segments(64); /// } /// # bevy_ecs::system::assert_is_system(system); diff --git a/crates/bevy_gizmos/src/arrows.rs b/crates/bevy_gizmos/src/arrows.rs index 498ec71e9eaa0b..ddac8a8c7c5471 100644 --- a/crates/bevy_gizmos/src/arrows.rs +++ b/crates/bevy_gizmos/src/arrows.rs @@ -25,8 +25,9 @@ impl ArrowBuilder<'_, '_, '_, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::GREEN; /// fn system(mut gizmos: Gizmos) { - /// gizmos.arrow(Vec3::ZERO, Vec3::ONE, Color::GREEN) + /// gizmos.arrow(Vec3::ZERO, Vec3::ONE, GREEN) /// .with_tip_length(3.); /// } /// # bevy_ecs::system::assert_is_system(system); @@ -76,8 +77,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::GREEN; /// fn system(mut gizmos: Gizmos) { - /// gizmos.arrow(Vec3::ZERO, Vec3::ONE, Color::GREEN); + /// gizmos.arrow(Vec3::ZERO, Vec3::ONE, GREEN); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` @@ -106,8 +108,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::GREEN; /// fn system(mut gizmos: Gizmos) { - /// gizmos.arrow_2d(Vec2::ZERO, Vec2::X, Color::GREEN); + /// gizmos.arrow_2d(Vec2::ZERO, Vec2::X, GREEN); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` diff --git a/crates/bevy_gizmos/src/circles.rs b/crates/bevy_gizmos/src/circles.rs index ea3937a1c68252..f0d4a03f4bd404 100644 --- a/crates/bevy_gizmos/src/circles.rs +++ b/crates/bevy_gizmos/src/circles.rs @@ -29,13 +29,14 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::{RED, GREEN}; /// fn system(mut gizmos: Gizmos) { - /// gizmos.ellipse(Vec3::ZERO, Quat::IDENTITY, Vec2::new(1., 2.), Color::GREEN); + /// gizmos.ellipse(Vec3::ZERO, Quat::IDENTITY, Vec2::new(1., 2.), GREEN); /// /// // Ellipses have 32 line-segments by default. /// // You may want to increase this for larger ellipses. /// gizmos - /// .ellipse(Vec3::ZERO, Quat::IDENTITY, Vec2::new(5., 1.), Color::RED) + /// .ellipse(Vec3::ZERO, Quat::IDENTITY, Vec2::new(5., 1.), RED) /// .segments(64); /// } /// # bevy_ecs::system::assert_is_system(system); @@ -67,13 +68,14 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::{RED, GREEN}; /// fn system(mut gizmos: Gizmos) { - /// gizmos.ellipse_2d(Vec2::ZERO, 180.0_f32.to_radians(), Vec2::new(2., 1.), Color::GREEN); + /// gizmos.ellipse_2d(Vec2::ZERO, 180.0_f32.to_radians(), Vec2::new(2., 1.), GREEN); /// /// // Ellipses have 32 line-segments by default. /// // You may want to increase this for larger ellipses. /// gizmos - /// .ellipse_2d(Vec2::ZERO, 180.0_f32.to_radians(), Vec2::new(5., 1.), Color::RED) + /// .ellipse_2d(Vec2::ZERO, 180.0_f32.to_radians(), Vec2::new(5., 1.), RED) /// .segments(64); /// } /// # bevy_ecs::system::assert_is_system(system); @@ -105,13 +107,14 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::{RED, GREEN}; /// fn system(mut gizmos: Gizmos) { - /// gizmos.circle(Vec3::ZERO, Direction3d::Z, 1., Color::GREEN); + /// gizmos.circle(Vec3::ZERO, Direction3d::Z, 1., GREEN); /// /// // Circles have 32 line-segments by default. /// // You may want to increase this for larger circles. /// gizmos - /// .circle(Vec3::ZERO, Direction3d::Z, 5., Color::RED) + /// .circle(Vec3::ZERO, Direction3d::Z, 5., RED) /// .segments(64); /// } /// # bevy_ecs::system::assert_is_system(system); @@ -143,13 +146,14 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::{RED, GREEN}; /// fn system(mut gizmos: Gizmos) { - /// gizmos.circle_2d(Vec2::ZERO, 1., Color::GREEN); + /// gizmos.circle_2d(Vec2::ZERO, 1., GREEN); /// /// // Circles have 32 line-segments by default. /// // You may want to increase this for larger circles. /// gizmos - /// .circle_2d(Vec2::ZERO, 5., Color::RED) + /// .circle_2d(Vec2::ZERO, 5., RED) /// .segments(64); /// } /// # bevy_ecs::system::assert_is_system(system); diff --git a/crates/bevy_gizmos/src/gizmos.rs b/crates/bevy_gizmos/src/gizmos.rs index 4f85bbcbd3ef49..dc6032bc4ece50 100644 --- a/crates/bevy_gizmos/src/gizmos.rs +++ b/crates/bevy_gizmos/src/gizmos.rs @@ -129,8 +129,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::GREEN; /// fn system(mut gizmos: Gizmos) { - /// gizmos.line(Vec3::ZERO, Vec3::X, Color::GREEN); + /// gizmos.line(Vec3::ZERO, Vec3::X, GREEN); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` @@ -152,8 +153,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::{RED, GREEN}; /// fn system(mut gizmos: Gizmos) { - /// gizmos.line_gradient(Vec3::ZERO, Vec3::X, Color::GREEN, Color::RED); + /// gizmos.line_gradient(Vec3::ZERO, Vec3::X, GREEN, RED); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` @@ -181,8 +183,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::GREEN; /// fn system(mut gizmos: Gizmos) { - /// gizmos.ray(Vec3::Y, Vec3::X, Color::GREEN); + /// gizmos.ray(Vec3::Y, Vec3::X, GREEN); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` @@ -203,8 +206,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::{RED, GREEN}; /// fn system(mut gizmos: Gizmos) { - /// gizmos.ray_gradient(Vec3::Y, Vec3::X, Color::GREEN, Color::RED); + /// gizmos.ray_gradient(Vec3::Y, Vec3::X, GREEN, RED); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` @@ -231,8 +235,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::GREEN; /// fn system(mut gizmos: Gizmos) { - /// gizmos.linestrip([Vec3::ZERO, Vec3::X, Vec3::Y], Color::GREEN); + /// gizmos.linestrip([Vec3::ZERO, Vec3::X, Vec3::Y], GREEN); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` @@ -261,11 +266,12 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::{BLUE, GREEN, RED}; /// fn system(mut gizmos: Gizmos) { /// gizmos.linestrip_gradient([ - /// (Vec3::ZERO, Color::GREEN), - /// (Vec3::X, Color::RED), - /// (Vec3::Y, Color::BLUE) + /// (Vec3::ZERO, GREEN), + /// (Vec3::X, RED), + /// (Vec3::Y, BLUE) /// ]); /// } /// # bevy_ecs::system::assert_is_system(system); @@ -346,8 +352,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::GREEN; /// fn system(mut gizmos: Gizmos) { - /// gizmos.rect(Vec3::ZERO, Quat::IDENTITY, Vec2::ONE, Color::GREEN); + /// gizmos.rect(Vec3::ZERO, Quat::IDENTITY, Vec2::ONE, GREEN); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` @@ -369,8 +376,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_transform::prelude::*; + /// # use bevy_color::palettes::basic::GREEN; /// fn system(mut gizmos: Gizmos) { - /// gizmos.cuboid(Transform::IDENTITY, Color::GREEN); + /// gizmos.cuboid(Transform::IDENTITY, GREEN); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` @@ -409,8 +417,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::GREEN; /// fn system(mut gizmos: Gizmos) { - /// gizmos.line_2d(Vec2::ZERO, Vec2::X, Color::GREEN); + /// gizmos.line_2d(Vec2::ZERO, Vec2::X, GREEN); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` @@ -431,8 +440,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::{RED, GREEN}; /// fn system(mut gizmos: Gizmos) { - /// gizmos.line_gradient_2d(Vec2::ZERO, Vec2::X, Color::GREEN, Color::RED); + /// gizmos.line_gradient_2d(Vec2::ZERO, Vec2::X, GREEN, RED); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` @@ -459,8 +469,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::GREEN; /// fn system(mut gizmos: Gizmos) { - /// gizmos.linestrip_2d([Vec2::ZERO, Vec2::X, Vec2::Y], Color::GREEN); + /// gizmos.linestrip_2d([Vec2::ZERO, Vec2::X, Vec2::Y], GREEN); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` @@ -485,11 +496,12 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::{RED, GREEN, BLUE}; /// fn system(mut gizmos: Gizmos) { /// gizmos.linestrip_gradient_2d([ - /// (Vec2::ZERO, Color::GREEN), - /// (Vec2::X, Color::RED), - /// (Vec2::Y, Color::BLUE) + /// (Vec2::ZERO, GREEN), + /// (Vec2::X, RED), + /// (Vec2::Y, BLUE) /// ]); /// } /// # bevy_ecs::system::assert_is_system(system); @@ -518,8 +530,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::GREEN; /// fn system(mut gizmos: Gizmos) { - /// gizmos.ray_2d(Vec2::Y, Vec2::X, Color::GREEN); + /// gizmos.ray_2d(Vec2::Y, Vec2::X, GREEN); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` @@ -540,8 +553,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::{RED, GREEN}; /// fn system(mut gizmos: Gizmos) { - /// gizmos.line_gradient(Vec3::Y, Vec3::X, Color::GREEN, Color::RED); + /// gizmos.line_gradient(Vec3::Y, Vec3::X, GREEN, RED); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` @@ -568,8 +582,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> { /// # use bevy_gizmos::prelude::*; /// # use bevy_render::prelude::*; /// # use bevy_math::prelude::*; + /// # use bevy_color::palettes::basic::GREEN; /// fn system(mut gizmos: Gizmos) { - /// gizmos.rect_2d(Vec2::ZERO, 0., Vec2::ONE, Color::GREEN); + /// gizmos.rect_2d(Vec2::ZERO, 0., Vec2::ONE, GREEN); /// } /// # bevy_ecs::system::assert_is_system(system); /// ``` diff --git a/crates/bevy_gizmos/src/lib.rs b/crates/bevy_gizmos/src/lib.rs index c77f38eee0aaa2..1b83968f070dd1 100644 --- a/crates/bevy_gizmos/src/lib.rs +++ b/crates/bevy_gizmos/src/lib.rs @@ -5,8 +5,9 @@ //! # use bevy_gizmos::prelude::*; //! # use bevy_render::prelude::*; //! # use bevy_math::prelude::*; +//! # use bevy_color::palettes::basic::GREEN; //! fn system(mut gizmos: Gizmos) { -//! gizmos.line(Vec3::ZERO, Vec3::X, Color::GREEN); +//! gizmos.line(Vec3::ZERO, Vec3::X, GREEN); //! } //! # bevy_ecs::system::assert_is_system(system); //! ```