Skip to content

Commit 0746b8e

Browse files
authored
Fix green colors becoming darker in various examples (#12328)
# Objective Fixes #12225 Prior to the `bevy_color` port, `GREEN` used to mean "full green." But it is now a much darker color matching the css1 spec. ## Solution Change usages of `basic::GREEN` or `css::GREEN` to `LIME` to restore the examples to their former colors. This also removes the duplicate definition of `GREEN` from `css`. (it was already re-exported from `basic`) ## Note A lot of these examples could use nicer colors. I'm not trying to do that here. "Dark Grey" will be tackled separately and has its own tracking issue.
1 parent ba9d1ef commit 0746b8e

File tree

19 files changed

+34
-42
lines changed

19 files changed

+34
-42
lines changed

crates/bevy_color/src/palettes/css.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ pub const GOLD: Srgba = Srgba::new(1.0, 0.843, 0.0, 1.0);
106106
/// <div style="background-color:rgb(85.5%, 64.7%, 12.5%); width: 10px; padding: 10px; border: 1px solid;"></div>
107107
pub const GOLDENROD: Srgba = Srgba::new(0.855, 0.647, 0.125, 1.0);
108108
/// <div style="background-color:rgb(0.0%, 50.2%, 0.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
109-
pub const GREEN: Srgba = Srgba::new(0.0, 0.502, 0.0, 1.0);
110-
/// <div style="background-color:rgb(67.80000000000001%, 100.0%, 18.4%); width: 10px; padding: 10px; border: 1px solid;"></div>
111109
pub const GREEN_YELLOW: Srgba = Srgba::new(0.678, 1.0, 0.184, 1.0);
112110
/// <div style="background-color:rgb(50.2%, 50.2%, 50.2%); width: 10px; padding: 10px; border: 1px solid;"></div>
113111
pub const GREY: Srgba = Srgba::new(0.502, 0.502, 0.502, 1.0);

examples/2d/bounding_2d.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,7 @@ fn ray_cast_system(
324324
**intersects = toi.is_some();
325325
if let Some(toi) = toi {
326326
for r in [1., 2., 3.] {
327-
gizmos.circle_2d(
328-
ray_cast.ray.origin + *ray_cast.ray.direction * toi,
329-
r,
330-
GREEN,
331-
);
327+
gizmos.circle_2d(ray_cast.ray.origin + *ray_cast.ray.direction * toi, r, LIME);
332328
}
333329
}
334330
}
@@ -359,7 +355,7 @@ fn aabb_cast_system(
359355
+ aabb_cast.aabb.center(),
360356
0.,
361357
aabb_cast.aabb.half_size() * 2.,
362-
GREEN,
358+
LIME,
363359
);
364360
}
365361
}
@@ -389,7 +385,7 @@ fn bounding_circle_cast_system(
389385
+ *circle_cast.ray.ray.direction * toi
390386
+ circle_cast.circle.center(),
391387
circle_cast.circle.radius(),
392-
GREEN,
388+
LIME,
393389
);
394390
}
395391
}

examples/2d/text2d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
141141

142142
for (text_anchor, color) in [
143143
(Anchor::TopLeft, Color::Srgba(RED)),
144-
(Anchor::TopRight, Color::Srgba(GREEN)),
144+
(Anchor::TopRight, Color::Srgba(LIME)),
145145
(Anchor::BottomRight, Color::Srgba(BLUE)),
146146
(Anchor::BottomLeft, Color::Srgba(YELLOW)),
147147
] {

examples/3d/lighting.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ fn setup(
159159
.looking_at(Vec3::new(-1.0, 0.0, 0.0), Vec3::Z),
160160
spot_light: SpotLight {
161161
intensity: 100_000.0,
162-
color: GREEN.into(),
162+
color: LIME.into(),
163163
shadows_enabled: true,
164164
inner_angle: 0.6,
165165
outer_angle: 0.8,
@@ -172,7 +172,7 @@ fn setup(
172172
transform: Transform::from_rotation(Quat::from_rotation_x(PI / 2.0)),
173173
mesh: meshes.add(Capsule3d::new(0.1, 0.125)),
174174
material: materials.add(StandardMaterial {
175-
base_color: GREEN.into(),
175+
base_color: LIME.into(),
176176
emissive: Color::linear_rgba(0.0, 7.13, 0.0, 0.0),
177177
..default()
178178
}),

examples/3d/shadow_caster_receiver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::f32::consts::PI;
44

55
use bevy::{
6-
color::palettes::basic::{BLUE, GREEN, RED},
6+
color::palettes::basic::{BLUE, LIME, RED},
77
pbr::{light_consts, CascadeShadowConfigBuilder, NotShadowCaster, NotShadowReceiver},
88
prelude::*,
99
};
@@ -62,7 +62,7 @@ fn setup(
6262
commands.spawn((
6363
PbrBundle {
6464
mesh: meshes.add(Plane3d::default().mesh().size(20.0, 20.0)),
65-
material: materials.add(Color::from(GREEN)),
65+
material: materials.add(Color::from(LIME)),
6666
transform: Transform::from_xyz(0.0, 1.0, -10.0),
6767
..default()
6868
},

examples/3d/transmission.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ fn setup(
213213
PbrBundle {
214214
mesh: icosphere_mesh.clone(),
215215
material: materials.add(StandardMaterial {
216-
base_color: GREEN.into(),
216+
base_color: LIME.into(),
217217
specular_transmission: 0.9,
218218
diffuse_transmission: 1.0,
219219
thickness: 1.8,

examples/3d/wireframe.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,14 @@ fn setup(
8282
commands.spawn((
8383
PbrBundle {
8484
mesh: meshes.add(Cuboid::default()),
85-
material: materials.add(Color::from(GREEN)),
85+
material: materials.add(Color::from(LIME)),
8686
transform: Transform::from_xyz(1.0, 0.5, 1.0),
8787
..default()
8888
},
8989
Wireframe,
9090
// This lets you configure the wireframe color of this entity.
9191
// If not set, this will use the color in `WireframeConfig`
92-
WireframeColor {
93-
color: GREEN.into(),
94-
},
92+
WireframeColor { color: LIME.into() },
9593
));
9694

9795
// light
@@ -157,10 +155,10 @@ Color: {:?}
157155
// Toggle the color of a wireframe using WireframeColor and not the global color
158156
if keyboard_input.just_pressed(KeyCode::KeyC) {
159157
for mut color in &mut wireframe_colors {
160-
color.color = if color.color == GREEN.into() {
158+
color.color = if color.color == LIME.into() {
161159
RED.into()
162160
} else {
163-
GREEN.into()
161+
LIME.into()
164162
};
165163
}
166164
}

examples/audio/spatial_audio_2d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn setup(
6565
// right ear
6666
parent.spawn(SpriteBundle {
6767
sprite: Sprite {
68-
color: GREEN.into(),
68+
color: LIME.into(),
6969
custom_size: Some(Vec2::splat(20.0)),
7070
..default()
7171
},

examples/audio/spatial_audio_3d.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! This example illustrates how to load and play an audio file, and control where the sounds seems to come from.
22
use bevy::{
3-
color::palettes::basic::{BLUE, GREEN, RED},
3+
color::palettes::basic::{BLUE, LIME, RED},
44
prelude::*,
55
};
66

@@ -52,7 +52,7 @@ fn setup(
5252
// right ear indicator
5353
parent.spawn(PbrBundle {
5454
mesh: meshes.add(Cuboid::new(0.2, 0.2, 0.2)),
55-
material: materials.add(Color::from(GREEN)),
55+
material: materials.add(Color::from(LIME)),
5656
transform: Transform::from_translation(listener.right_ear_offset),
5757
..default()
5858
});

examples/ecs/hierarchy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
4747
transform: Transform::from_xyz(0.0, 250.0, 0.0).with_scale(Vec3::splat(0.75)),
4848
texture,
4949
sprite: Sprite {
50-
color: GREEN.into(),
50+
color: LIME.into(),
5151
..default()
5252
},
5353
..default()

0 commit comments

Comments
 (0)