Skip to content

Commit e00b6bd

Browse files
author
Alice Cecile
committed
Fix color constants in gizmo docs tests
1 parent 21de265 commit e00b6bd

File tree

5 files changed

+63
-36
lines changed

5 files changed

+63
-36
lines changed

crates/bevy_gizmos/src/arcs.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
2929
/// # use bevy_render::prelude::*;
3030
/// # use bevy_math::prelude::*;
3131
/// # use std::f32::consts::PI;
32+
/// # use bevy_color::palettes::basic::{GREEN, RED};
3233
/// fn system(mut gizmos: Gizmos) {
33-
/// gizmos.arc_2d(Vec2::ZERO, 0., PI / 4., 1., Color::GREEN);
34+
/// gizmos.arc_2d(Vec2::ZERO, 0., PI / 4., 1., GREEN);
3435
///
3536
/// // Arcs have 32 line-segments by default.
3637
/// // You may want to increase this for larger arcs.
3738
/// gizmos
38-
/// .arc_2d(Vec2::ZERO, 0., PI / 4., 5., Color::RED)
39+
/// .arc_2d(Vec2::ZERO, 0., PI / 4., 5., RED)
3940
/// .segments(64);
4041
/// }
4142
/// # bevy_ecs::system::assert_is_system(system);
@@ -142,6 +143,7 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
142143
/// # use bevy_render::prelude::*;
143144
/// # use bevy_math::prelude::*;
144145
/// # use std::f32::consts::PI;
146+
/// # use bevy_color::palettes::basic::ORANGE;
145147
/// fn system(mut gizmos: Gizmos) {
146148
/// // rotation rotates normal to point in the direction of `Vec3::NEG_ONE`
147149
/// let rotation = Quat::from_rotation_arc(Vec3::Y, Vec3::NEG_ONE.normalize());
@@ -152,7 +154,7 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
152154
/// 0.25,
153155
/// Vec3::ONE,
154156
/// rotation,
155-
/// Color::ORANGE
157+
/// ORANGE
156158
/// )
157159
/// .segments(100);
158160
/// }
@@ -197,12 +199,13 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
197199
/// # use bevy_gizmos::prelude::*;
198200
/// # use bevy_render::prelude::*;
199201
/// # use bevy_math::prelude::*;
202+
/// # use bevy_color::palettes::basic::ORANGE;
200203
/// fn system(mut gizmos: Gizmos) {
201204
/// gizmos.short_arc_3d_between(
202205
/// Vec3::ONE,
203206
/// Vec3::ONE + Vec3::NEG_ONE,
204207
/// Vec3::ZERO,
205-
/// Color::ORANGE
208+
/// ORANGE
206209
/// )
207210
/// .segments(100);
208211
/// }
@@ -243,12 +246,13 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
243246
/// # use bevy_gizmos::prelude::*;
244247
/// # use bevy_render::prelude::*;
245248
/// # use bevy_math::prelude::*;
249+
/// # use bevy_color::palettes::basic::ORANGE;
246250
/// fn system(mut gizmos: Gizmos) {
247251
/// gizmos.long_arc_3d_between(
248252
/// Vec3::ONE,
249253
/// Vec3::ONE + Vec3::NEG_ONE,
250254
/// Vec3::ZERO,
251-
/// Color::ORANGE
255+
/// ORANGE
252256
/// )
253257
/// .segments(100);
254258
/// }

crates/bevy_gizmos/src/arrows.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ impl<T: GizmoConfigGroup> ArrowBuilder<'_, '_, '_, T> {
2525
/// # use bevy_gizmos::prelude::*;
2626
/// # use bevy_render::prelude::*;
2727
/// # use bevy_math::prelude::*;
28+
/// # use bevy_color::palettes::basic::GREEN;
2829
/// fn system(mut gizmos: Gizmos) {
29-
/// gizmos.arrow(Vec3::ZERO, Vec3::ONE, Color::GREEN)
30+
/// gizmos.arrow(Vec3::ZERO, Vec3::ONE, GREEN)
3031
/// .with_tip_length(3.);
3132
/// }
3233
/// # bevy_ecs::system::assert_is_system(system);
@@ -76,8 +77,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
7677
/// # use bevy_gizmos::prelude::*;
7778
/// # use bevy_render::prelude::*;
7879
/// # use bevy_math::prelude::*;
80+
/// # use bevy_color::palettes::basic::GREEN;
7981
/// fn system(mut gizmos: Gizmos) {
80-
/// gizmos.arrow(Vec3::ZERO, Vec3::ONE, Color::GREEN);
82+
/// gizmos.arrow(Vec3::ZERO, Vec3::ONE, GREEN);
8183
/// }
8284
/// # bevy_ecs::system::assert_is_system(system);
8385
/// ```
@@ -106,8 +108,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
106108
/// # use bevy_gizmos::prelude::*;
107109
/// # use bevy_render::prelude::*;
108110
/// # use bevy_math::prelude::*;
111+
/// # use bevy_color::palettes::basic::GREEN;
109112
/// fn system(mut gizmos: Gizmos) {
110-
/// gizmos.arrow_2d(Vec2::ZERO, Vec2::X, Color::GREEN);
113+
/// gizmos.arrow_2d(Vec2::ZERO, Vec2::X, GREEN);
111114
/// }
112115
/// # bevy_ecs::system::assert_is_system(system);
113116
/// ```

crates/bevy_gizmos/src/circles.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
2929
/// # use bevy_gizmos::prelude::*;
3030
/// # use bevy_render::prelude::*;
3131
/// # use bevy_math::prelude::*;
32+
/// # use bevy_color::palettes::basic::{RED, GREEN};
3233
/// fn system(mut gizmos: Gizmos) {
33-
/// gizmos.ellipse(Vec3::ZERO, Quat::IDENTITY, Vec2::new(1., 2.), Color::GREEN);
34+
/// gizmos.ellipse(Vec3::ZERO, Quat::IDENTITY, Vec2::new(1., 2.), GREEN);
3435
///
3536
/// // Ellipses have 32 line-segments by default.
3637
/// // You may want to increase this for larger ellipses.
3738
/// gizmos
38-
/// .ellipse(Vec3::ZERO, Quat::IDENTITY, Vec2::new(5., 1.), Color::RED)
39+
/// .ellipse(Vec3::ZERO, Quat::IDENTITY, Vec2::new(5., 1.), RED)
3940
/// .segments(64);
4041
/// }
4142
/// # bevy_ecs::system::assert_is_system(system);
@@ -67,13 +68,14 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
6768
/// # use bevy_gizmos::prelude::*;
6869
/// # use bevy_render::prelude::*;
6970
/// # use bevy_math::prelude::*;
71+
/// # use bevy_color::palettes::basic::{RED, GREEN};
7072
/// fn system(mut gizmos: Gizmos) {
71-
/// gizmos.ellipse_2d(Vec2::ZERO, 180.0_f32.to_radians(), Vec2::new(2., 1.), Color::GREEN);
73+
/// gizmos.ellipse_2d(Vec2::ZERO, 180.0_f32.to_radians(), Vec2::new(2., 1.), GREEN);
7274
///
7375
/// // Ellipses have 32 line-segments by default.
7476
/// // You may want to increase this for larger ellipses.
7577
/// gizmos
76-
/// .ellipse_2d(Vec2::ZERO, 180.0_f32.to_radians(), Vec2::new(5., 1.), Color::RED)
78+
/// .ellipse_2d(Vec2::ZERO, 180.0_f32.to_radians(), Vec2::new(5., 1.), RED)
7779
/// .segments(64);
7880
/// }
7981
/// # bevy_ecs::system::assert_is_system(system);
@@ -105,13 +107,14 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
105107
/// # use bevy_gizmos::prelude::*;
106108
/// # use bevy_render::prelude::*;
107109
/// # use bevy_math::prelude::*;
110+
/// # use bevy_color::palettes::basic::{RED, GREEN};
108111
/// fn system(mut gizmos: Gizmos) {
109-
/// gizmos.circle(Vec3::ZERO, Direction3d::Z, 1., Color::GREEN);
112+
/// gizmos.circle(Vec3::ZERO, Direction3d::Z, 1., GREEN);
110113
///
111114
/// // Circles have 32 line-segments by default.
112115
/// // You may want to increase this for larger circles.
113116
/// gizmos
114-
/// .circle(Vec3::ZERO, Direction3d::Z, 5., Color::RED)
117+
/// .circle(Vec3::ZERO, Direction3d::Z, 5., RED)
115118
/// .segments(64);
116119
/// }
117120
/// # bevy_ecs::system::assert_is_system(system);
@@ -143,13 +146,14 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
143146
/// # use bevy_gizmos::prelude::*;
144147
/// # use bevy_render::prelude::*;
145148
/// # use bevy_math::prelude::*;
149+
/// # use bevy_color::palettes::basic::{RED, GREEN};
146150
/// fn system(mut gizmos: Gizmos) {
147-
/// gizmos.circle_2d(Vec2::ZERO, 1., Color::GREEN);
151+
/// gizmos.circle_2d(Vec2::ZERO, 1., GREEN);
148152
///
149153
/// // Circles have 32 line-segments by default.
150154
/// // You may want to increase this for larger circles.
151155
/// gizmos
152-
/// .circle_2d(Vec2::ZERO, 5., Color::RED)
156+
/// .circle_2d(Vec2::ZERO, 5., RED)
153157
/// .segments(64);
154158
/// }
155159
/// # bevy_ecs::system::assert_is_system(system);

crates/bevy_gizmos/src/gizmos.rs

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
129129
/// # use bevy_gizmos::prelude::*;
130130
/// # use bevy_render::prelude::*;
131131
/// # use bevy_math::prelude::*;
132+
/// # use bevy_color::palettes::basic::GREEN;
132133
/// fn system(mut gizmos: Gizmos) {
133-
/// gizmos.line(Vec3::ZERO, Vec3::X, Color::GREEN);
134+
/// gizmos.line(Vec3::ZERO, Vec3::X, GREEN);
134135
/// }
135136
/// # bevy_ecs::system::assert_is_system(system);
136137
/// ```
@@ -152,8 +153,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
152153
/// # use bevy_gizmos::prelude::*;
153154
/// # use bevy_render::prelude::*;
154155
/// # use bevy_math::prelude::*;
156+
/// # use bevy_color::palettes::basic::{RED, GREEN};
155157
/// fn system(mut gizmos: Gizmos) {
156-
/// gizmos.line_gradient(Vec3::ZERO, Vec3::X, Color::GREEN, Color::RED);
158+
/// gizmos.line_gradient(Vec3::ZERO, Vec3::X, GREEN, RED);
157159
/// }
158160
/// # bevy_ecs::system::assert_is_system(system);
159161
/// ```
@@ -181,8 +183,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
181183
/// # use bevy_gizmos::prelude::*;
182184
/// # use bevy_render::prelude::*;
183185
/// # use bevy_math::prelude::*;
186+
/// # use bevy_color::palettes::basic::GREEN;
184187
/// fn system(mut gizmos: Gizmos) {
185-
/// gizmos.ray(Vec3::Y, Vec3::X, Color::GREEN);
188+
/// gizmos.ray(Vec3::Y, Vec3::X, GREEN);
186189
/// }
187190
/// # bevy_ecs::system::assert_is_system(system);
188191
/// ```
@@ -203,8 +206,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
203206
/// # use bevy_gizmos::prelude::*;
204207
/// # use bevy_render::prelude::*;
205208
/// # use bevy_math::prelude::*;
209+
/// # use bevy_color::palettes::basic::{RED, GREEN};
206210
/// fn system(mut gizmos: Gizmos) {
207-
/// gizmos.ray_gradient(Vec3::Y, Vec3::X, Color::GREEN, Color::RED);
211+
/// gizmos.ray_gradient(Vec3::Y, Vec3::X, GREEN, RED);
208212
/// }
209213
/// # bevy_ecs::system::assert_is_system(system);
210214
/// ```
@@ -231,8 +235,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
231235
/// # use bevy_gizmos::prelude::*;
232236
/// # use bevy_render::prelude::*;
233237
/// # use bevy_math::prelude::*;
238+
/// # use bevy_color::palettes::basic::GREEN;
234239
/// fn system(mut gizmos: Gizmos) {
235-
/// gizmos.linestrip([Vec3::ZERO, Vec3::X, Vec3::Y], Color::GREEN);
240+
/// gizmos.linestrip([Vec3::ZERO, Vec3::X, Vec3::Y], GREEN);
236241
/// }
237242
/// # bevy_ecs::system::assert_is_system(system);
238243
/// ```
@@ -261,11 +266,12 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
261266
/// # use bevy_gizmos::prelude::*;
262267
/// # use bevy_render::prelude::*;
263268
/// # use bevy_math::prelude::*;
269+
/// # use bevy_color::palettes::basic::{BLUE, GREEN, RED};
264270
/// fn system(mut gizmos: Gizmos) {
265271
/// gizmos.linestrip_gradient([
266-
/// (Vec3::ZERO, Color::GREEN),
267-
/// (Vec3::X, Color::RED),
268-
/// (Vec3::Y, Color::BLUE)
272+
/// (Vec3::ZERO, GREEN),
273+
/// (Vec3::X, RED),
274+
/// (Vec3::Y, BLUE)
269275
/// ]);
270276
/// }
271277
/// # bevy_ecs::system::assert_is_system(system);
@@ -346,8 +352,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
346352
/// # use bevy_gizmos::prelude::*;
347353
/// # use bevy_render::prelude::*;
348354
/// # use bevy_math::prelude::*;
355+
/// # use bevy_color::palettes::basic::GREEN;
349356
/// fn system(mut gizmos: Gizmos) {
350-
/// gizmos.rect(Vec3::ZERO, Quat::IDENTITY, Vec2::ONE, Color::GREEN);
357+
/// gizmos.rect(Vec3::ZERO, Quat::IDENTITY, Vec2::ONE, GREEN);
351358
/// }
352359
/// # bevy_ecs::system::assert_is_system(system);
353360
/// ```
@@ -369,8 +376,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
369376
/// # use bevy_gizmos::prelude::*;
370377
/// # use bevy_render::prelude::*;
371378
/// # use bevy_transform::prelude::*;
379+
/// # use bevy_color::palettes::basic::GREEN;
372380
/// fn system(mut gizmos: Gizmos) {
373-
/// gizmos.cuboid(Transform::IDENTITY, Color::GREEN);
381+
/// gizmos.cuboid(Transform::IDENTITY, GREEN);
374382
/// }
375383
/// # bevy_ecs::system::assert_is_system(system);
376384
/// ```
@@ -409,8 +417,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
409417
/// # use bevy_gizmos::prelude::*;
410418
/// # use bevy_render::prelude::*;
411419
/// # use bevy_math::prelude::*;
420+
/// # use bevy_color::palettes::basic::GREEN;
412421
/// fn system(mut gizmos: Gizmos) {
413-
/// gizmos.line_2d(Vec2::ZERO, Vec2::X, Color::GREEN);
422+
/// gizmos.line_2d(Vec2::ZERO, Vec2::X, GREEN);
414423
/// }
415424
/// # bevy_ecs::system::assert_is_system(system);
416425
/// ```
@@ -431,8 +440,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
431440
/// # use bevy_gizmos::prelude::*;
432441
/// # use bevy_render::prelude::*;
433442
/// # use bevy_math::prelude::*;
443+
/// # use bevy_color::palettes::basic::{RED, GREEN};
434444
/// fn system(mut gizmos: Gizmos) {
435-
/// gizmos.line_gradient_2d(Vec2::ZERO, Vec2::X, Color::GREEN, Color::RED);
445+
/// gizmos.line_gradient_2d(Vec2::ZERO, Vec2::X, GREEN, RED);
436446
/// }
437447
/// # bevy_ecs::system::assert_is_system(system);
438448
/// ```
@@ -459,8 +469,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
459469
/// # use bevy_gizmos::prelude::*;
460470
/// # use bevy_render::prelude::*;
461471
/// # use bevy_math::prelude::*;
472+
/// # use bevy_color::palettes::basic::GREEN;
462473
/// fn system(mut gizmos: Gizmos) {
463-
/// gizmos.linestrip_2d([Vec2::ZERO, Vec2::X, Vec2::Y], Color::GREEN);
474+
/// gizmos.linestrip_2d([Vec2::ZERO, Vec2::X, Vec2::Y], GREEN);
464475
/// }
465476
/// # bevy_ecs::system::assert_is_system(system);
466477
/// ```
@@ -485,11 +496,12 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
485496
/// # use bevy_gizmos::prelude::*;
486497
/// # use bevy_render::prelude::*;
487498
/// # use bevy_math::prelude::*;
499+
/// # use bevy_color::palettes::basic::{RED, GREEN, BLUE};
488500
/// fn system(mut gizmos: Gizmos) {
489501
/// gizmos.linestrip_gradient_2d([
490-
/// (Vec2::ZERO, Color::GREEN),
491-
/// (Vec2::X, Color::RED),
492-
/// (Vec2::Y, Color::BLUE)
502+
/// (Vec2::ZERO, GREEN),
503+
/// (Vec2::X, RED),
504+
/// (Vec2::Y, BLUE)
493505
/// ]);
494506
/// }
495507
/// # bevy_ecs::system::assert_is_system(system);
@@ -518,8 +530,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
518530
/// # use bevy_gizmos::prelude::*;
519531
/// # use bevy_render::prelude::*;
520532
/// # use bevy_math::prelude::*;
533+
/// # use bevy_color::palettes::basic::GREEN;
521534
/// fn system(mut gizmos: Gizmos) {
522-
/// gizmos.ray_2d(Vec2::Y, Vec2::X, Color::GREEN);
535+
/// gizmos.ray_2d(Vec2::Y, Vec2::X, GREEN);
523536
/// }
524537
/// # bevy_ecs::system::assert_is_system(system);
525538
/// ```
@@ -540,8 +553,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
540553
/// # use bevy_gizmos::prelude::*;
541554
/// # use bevy_render::prelude::*;
542555
/// # use bevy_math::prelude::*;
556+
/// # use bevy_color::palettes::basic::{RED, GREEN};
543557
/// fn system(mut gizmos: Gizmos) {
544-
/// gizmos.line_gradient(Vec3::Y, Vec3::X, Color::GREEN, Color::RED);
558+
/// gizmos.line_gradient(Vec3::Y, Vec3::X, GREEN, RED);
545559
/// }
546560
/// # bevy_ecs::system::assert_is_system(system);
547561
/// ```
@@ -568,8 +582,9 @@ impl<'w, 's, T: GizmoConfigGroup> Gizmos<'w, 's, T> {
568582
/// # use bevy_gizmos::prelude::*;
569583
/// # use bevy_render::prelude::*;
570584
/// # use bevy_math::prelude::*;
585+
/// # use bevy_color::palettes::basic::GREEN;
571586
/// fn system(mut gizmos: Gizmos) {
572-
/// gizmos.rect_2d(Vec2::ZERO, 0., Vec2::ONE, Color::GREEN);
587+
/// gizmos.rect_2d(Vec2::ZERO, 0., Vec2::ONE, GREEN);
573588
/// }
574589
/// # bevy_ecs::system::assert_is_system(system);
575590
/// ```

crates/bevy_gizmos/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
//! # use bevy_gizmos::prelude::*;
66
//! # use bevy_render::prelude::*;
77
//! # use bevy_math::prelude::*;
8+
//! # use bevy_color::palettes::basic::GREEN;
89
//! fn system(mut gizmos: Gizmos) {
9-
//! gizmos.line(Vec3::ZERO, Vec3::X, Color::GREEN);
10+
//! gizmos.line(Vec3::ZERO, Vec3::X, GREEN);
1011
//! }
1112
//! # bevy_ecs::system::assert_is_system(system);
1213
//! ```

0 commit comments

Comments
 (0)