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

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()

examples/games/game_menu.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ mod splash {
116116

117117
mod game {
118118
use bevy::{
119-
color::palettes::basic::{BLUE, GREEN},
119+
color::palettes::basic::{BLUE, LIME},
120120
prelude::*,
121121
};
122122

@@ -211,7 +211,7 @@ mod game {
211211
format!("volume: {:?}", *volume),
212212
TextStyle {
213213
font_size: 60.0,
214-
color: GREEN.into(),
214+
color: LIME.into(),
215215
..default()
216216
},
217217
),

examples/gizmos/2d_gizmos.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn draw_example_collection(
3939
) {
4040
let sin = time.elapsed_seconds().sin() * 50.;
4141
gizmos.line_2d(Vec2::Y * -sin, Vec2::splat(-80.), RED);
42-
gizmos.ray_2d(Vec2::Y * sin, Vec2::splat(80.), GREEN);
42+
gizmos.ray_2d(Vec2::Y * sin, Vec2::splat(80.), LIME);
4343

4444
gizmos
4545
.grid_2d(
@@ -56,7 +56,7 @@ fn draw_example_collection(
5656
gizmos.linestrip_gradient_2d([
5757
(Vec2::Y * 300., BLUE),
5858
(Vec2::new(-255., -155.), RED),
59-
(Vec2::new(255., -155.), GREEN),
59+
(Vec2::new(255., -155.), LIME),
6060
(Vec2::Y * 300., BLUE),
6161
]);
6262

examples/gizmos/3d_gizmos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn draw_example_collection(
103103
Vec3::new(time.elapsed_seconds().cos() * 2.5, 1., 0.),
104104
Quat::from_rotation_y(PI / 2.),
105105
Vec2::splat(2.),
106-
GREEN,
106+
LIME,
107107
);
108108

109109
my_gizmos.sphere(Vec3::new(1., 0.5, 0.), Quat::IDENTITY, 0.5, RED);

examples/stress_tests/bevymark.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,13 @@ fn setup(
253253
.with_children(|c| {
254254
c.spawn((
255255
TextBundle::from_sections([
256-
text_section(GREEN, "Bird Count: "),
256+
text_section(LIME, "Bird Count: "),
257257
text_section(AQUA, ""),
258-
text_section(GREEN, "\nFPS (raw): "),
258+
text_section(LIME, "\nFPS (raw): "),
259259
text_section(AQUA, ""),
260-
text_section(GREEN, "\nFPS (SMA): "),
260+
text_section(LIME, "\nFPS (SMA): "),
261261
text_section(AQUA, ""),
262-
text_section(GREEN, "\nFPS (EMA): "),
262+
text_section(LIME, "\nFPS (EMA): "),
263263
text_section(AQUA, ""),
264264
]),
265265
StatsText,

examples/ui/text_debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
170170
TextSection::from_style(TextStyle {
171171
font: font.clone(),
172172
font_size: 25.0,
173-
color: GREEN.into(),
173+
color: LIME.into(),
174174
}),
175175
TextSection::new(
176176
" ms/frame",

examples/ui/ui.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use bevy::{
55
accesskit::{NodeBuilder, Role},
66
AccessibilityNode,
77
},
8-
color::palettes::basic::GREEN,
8+
color::palettes::basic::LIME,
99
input::mouse::{MouseScrollUnit, MouseWheel},
1010
prelude::*,
1111
winit::WinitSettings,
@@ -166,7 +166,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
166166
border: UiRect::all(Val::Px(20.)),
167167
..default()
168168
},
169-
border_color: GREEN.into(),
169+
border_color: LIME.into(),
170170
background_color: Color::srgb(0.4, 0.4, 1.).into(),
171171
..default()
172172
})

examples/ui/viewport_debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use bevy::{color::palettes::css::*, prelude::*};
88

99
const PALETTE: [Srgba; 10] = [
10-
RED, YELLOW, WHITE, BEIGE, AQUA, CRIMSON, NAVY, AZURE, GREEN, BLACK,
10+
RED, YELLOW, WHITE, BEIGE, AQUA, CRIMSON, NAVY, AZURE, LIME, BLACK,
1111
];
1212

1313
#[derive(Component, Default, PartialEq)]

examples/ui/z_index.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! depth of nodes compared to their siblings, but also compared to the entire UI.
55
66
use bevy::{
7-
color::palettes::basic::{BLUE, GRAY, GREEN, PURPLE, RED, YELLOW},
7+
color::palettes::basic::{BLUE, GRAY, LIME, PURPLE, RED, YELLOW},
88
prelude::*,
99
};
1010

@@ -79,7 +79,7 @@ fn setup(mut commands: Commands) {
7979
// it will show under other nodes in the gray container.
8080
parent.spawn(NodeBundle {
8181
z_index: ZIndex::Local(-1),
82-
background_color: GREEN.into(),
82+
background_color: LIME.into(),
8383
style: Style {
8484
position_type: PositionType::Absolute,
8585
left: Val::Px(70.0),

examples/window/low_power.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ fn update_winit(
9393
pub(crate) mod test_setup {
9494
use crate::ExampleMode;
9595
use bevy::{
96-
color::palettes::basic::{GREEN, YELLOW},
96+
color::palettes::basic::{LIME, YELLOW},
9797
prelude::*,
9898
window::RequestRedraw,
9999
};
@@ -181,7 +181,7 @@ pub(crate) mod test_setup {
181181
),
182182
TextSection::from_style(TextStyle {
183183
font_size: 50.0,
184-
color: GREEN.into(),
184+
color: LIME.into(),
185185
..default()
186186
}),
187187
TextSection::new(

0 commit comments

Comments
 (0)