Skip to content

Commit

Permalink
Fix green colors becoming darker in various examples (bevyengine#12328)
Browse files Browse the repository at this point in the history
# Objective

Fixes bevyengine#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.
  • Loading branch information
rparrett authored and spectria-limina committed Mar 9, 2024
1 parent 16ddd33 commit c630b71
Show file tree
Hide file tree
Showing 19 changed files with 34 additions and 42 deletions.
2 changes: 0 additions & 2 deletions crates/bevy_color/src/palettes/css.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ pub const GOLD: Srgba = Srgba::new(1.0, 0.843, 0.0, 1.0);
/// <div style="background-color:rgb(85.5%, 64.7%, 12.5%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const GOLDENROD: Srgba = Srgba::new(0.855, 0.647, 0.125, 1.0);
/// <div style="background-color:rgb(0.0%, 50.2%, 0.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const GREEN: Srgba = Srgba::new(0.0, 0.502, 0.0, 1.0);
/// <div style="background-color:rgb(67.80000000000001%, 100.0%, 18.4%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const GREEN_YELLOW: Srgba = Srgba::new(0.678, 1.0, 0.184, 1.0);
/// <div style="background-color:rgb(50.2%, 50.2%, 50.2%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const GREY: Srgba = Srgba::new(0.502, 0.502, 0.502, 1.0);
Expand Down
10 changes: 3 additions & 7 deletions examples/2d/bounding_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,7 @@ fn ray_cast_system(
**intersects = toi.is_some();
if let Some(toi) = toi {
for r in [1., 2., 3.] {
gizmos.circle_2d(
ray_cast.ray.origin + *ray_cast.ray.direction * toi,
r,
GREEN,
);
gizmos.circle_2d(ray_cast.ray.origin + *ray_cast.ray.direction * toi, r, LIME);
}
}
}
Expand Down Expand Up @@ -359,7 +355,7 @@ fn aabb_cast_system(
+ aabb_cast.aabb.center(),
0.,
aabb_cast.aabb.half_size() * 2.,
GREEN,
LIME,
);
}
}
Expand Down Expand Up @@ -389,7 +385,7 @@ fn bounding_circle_cast_system(
+ *circle_cast.ray.ray.direction * toi
+ circle_cast.circle.center(),
circle_cast.circle.radius(),
GREEN,
LIME,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/2d/text2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {

for (text_anchor, color) in [
(Anchor::TopLeft, Color::Srgba(RED)),
(Anchor::TopRight, Color::Srgba(GREEN)),
(Anchor::TopRight, Color::Srgba(LIME)),
(Anchor::BottomRight, Color::Srgba(BLUE)),
(Anchor::BottomLeft, Color::Srgba(YELLOW)),
] {
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/lighting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ fn setup(
.looking_at(Vec3::new(-1.0, 0.0, 0.0), Vec3::Z),
spot_light: SpotLight {
intensity: 100_000.0,
color: GREEN.into(),
color: LIME.into(),
shadows_enabled: true,
inner_angle: 0.6,
outer_angle: 0.8,
Expand All @@ -172,7 +172,7 @@ fn setup(
transform: Transform::from_rotation(Quat::from_rotation_x(PI / 2.0)),
mesh: meshes.add(Capsule3d::new(0.1, 0.125)),
material: materials.add(StandardMaterial {
base_color: GREEN.into(),
base_color: LIME.into(),
emissive: Color::linear_rgba(0.0, 7.13, 0.0, 0.0),
..default()
}),
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/shadow_caster_receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::f32::consts::PI;

use bevy::{
color::palettes::basic::{BLUE, GREEN, RED},
color::palettes::basic::{BLUE, LIME, RED},
pbr::{light_consts, CascadeShadowConfigBuilder, NotShadowCaster, NotShadowReceiver},
prelude::*,
};
Expand Down Expand Up @@ -62,7 +62,7 @@ fn setup(
commands.spawn((
PbrBundle {
mesh: meshes.add(Plane3d::default().mesh().size(20.0, 20.0)),
material: materials.add(Color::from(GREEN)),
material: materials.add(Color::from(LIME)),
transform: Transform::from_xyz(0.0, 1.0, -10.0),
..default()
},
Expand Down
2 changes: 1 addition & 1 deletion examples/3d/transmission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ fn setup(
PbrBundle {
mesh: icosphere_mesh.clone(),
material: materials.add(StandardMaterial {
base_color: GREEN.into(),
base_color: LIME.into(),
specular_transmission: 0.9,
diffuse_transmission: 1.0,
thickness: 1.8,
Expand Down
10 changes: 4 additions & 6 deletions examples/3d/wireframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,14 @@ fn setup(
commands.spawn((
PbrBundle {
mesh: meshes.add(Cuboid::default()),
material: materials.add(Color::from(GREEN)),
material: materials.add(Color::from(LIME)),
transform: Transform::from_xyz(1.0, 0.5, 1.0),
..default()
},
Wireframe,
// This lets you configure the wireframe color of this entity.
// If not set, this will use the color in `WireframeConfig`
WireframeColor {
color: GREEN.into(),
},
WireframeColor { color: LIME.into() },
));

// light
Expand Down Expand Up @@ -157,10 +155,10 @@ Color: {:?}
// Toggle the color of a wireframe using WireframeColor and not the global color
if keyboard_input.just_pressed(KeyCode::KeyC) {
for mut color in &mut wireframe_colors {
color.color = if color.color == GREEN.into() {
color.color = if color.color == LIME.into() {
RED.into()
} else {
GREEN.into()
LIME.into()
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/audio/spatial_audio_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn setup(
// right ear
parent.spawn(SpriteBundle {
sprite: Sprite {
color: GREEN.into(),
color: LIME.into(),
custom_size: Some(Vec2::splat(20.0)),
..default()
},
Expand Down
4 changes: 2 additions & 2 deletions examples/audio/spatial_audio_3d.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This example illustrates how to load and play an audio file, and control where the sounds seems to come from.
use bevy::{
color::palettes::basic::{BLUE, GREEN, RED},
color::palettes::basic::{BLUE, LIME, RED},
prelude::*,
};

Expand Down Expand Up @@ -52,7 +52,7 @@ fn setup(
// right ear indicator
parent.spawn(PbrBundle {
mesh: meshes.add(Cuboid::new(0.2, 0.2, 0.2)),
material: materials.add(Color::from(GREEN)),
material: materials.add(Color::from(LIME)),
transform: Transform::from_translation(listener.right_ear_offset),
..default()
});
Expand Down
2 changes: 1 addition & 1 deletion examples/ecs/hierarchy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
transform: Transform::from_xyz(0.0, 250.0, 0.0).with_scale(Vec3::splat(0.75)),
texture,
sprite: Sprite {
color: GREEN.into(),
color: LIME.into(),
..default()
},
..default()
Expand Down
4 changes: 2 additions & 2 deletions examples/games/game_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ mod splash {

mod game {
use bevy::{
color::palettes::basic::{BLUE, GREEN},
color::palettes::basic::{BLUE, LIME},
prelude::*,
};

Expand Down Expand Up @@ -211,7 +211,7 @@ mod game {
format!("volume: {:?}", *volume),
TextStyle {
font_size: 60.0,
color: GREEN.into(),
color: LIME.into(),
..default()
},
),
Expand Down
4 changes: 2 additions & 2 deletions examples/gizmos/2d_gizmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn draw_example_collection(
) {
let sin = time.elapsed_seconds().sin() * 50.;
gizmos.line_2d(Vec2::Y * -sin, Vec2::splat(-80.), RED);
gizmos.ray_2d(Vec2::Y * sin, Vec2::splat(80.), GREEN);
gizmos.ray_2d(Vec2::Y * sin, Vec2::splat(80.), LIME);

gizmos
.grid_2d(
Expand All @@ -56,7 +56,7 @@ fn draw_example_collection(
gizmos.linestrip_gradient_2d([
(Vec2::Y * 300., BLUE),
(Vec2::new(-255., -155.), RED),
(Vec2::new(255., -155.), GREEN),
(Vec2::new(255., -155.), LIME),
(Vec2::Y * 300., BLUE),
]);

Expand Down
2 changes: 1 addition & 1 deletion examples/gizmos/3d_gizmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ fn draw_example_collection(
Vec3::new(time.elapsed_seconds().cos() * 2.5, 1., 0.),
Quat::from_rotation_y(PI / 2.),
Vec2::splat(2.),
GREEN,
LIME,
);

my_gizmos.sphere(Vec3::new(1., 0.5, 0.), Quat::IDENTITY, 0.5, RED);
Expand Down
8 changes: 4 additions & 4 deletions examples/stress_tests/bevymark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,13 @@ fn setup(
.with_children(|c| {
c.spawn((
TextBundle::from_sections([
text_section(GREEN, "Bird Count: "),
text_section(LIME, "Bird Count: "),
text_section(AQUA, ""),
text_section(GREEN, "\nFPS (raw): "),
text_section(LIME, "\nFPS (raw): "),
text_section(AQUA, ""),
text_section(GREEN, "\nFPS (SMA): "),
text_section(LIME, "\nFPS (SMA): "),
text_section(AQUA, ""),
text_section(GREEN, "\nFPS (EMA): "),
text_section(LIME, "\nFPS (EMA): "),
text_section(AQUA, ""),
]),
StatsText,
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/text_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
TextSection::from_style(TextStyle {
font: font.clone(),
font_size: 25.0,
color: GREEN.into(),
color: LIME.into(),
}),
TextSection::new(
" ms/frame",
Expand Down
4 changes: 2 additions & 2 deletions examples/ui/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use bevy::{
accesskit::{NodeBuilder, Role},
AccessibilityNode,
},
color::palettes::basic::GREEN,
color::palettes::basic::LIME,
input::mouse::{MouseScrollUnit, MouseWheel},
prelude::*,
winit::WinitSettings,
Expand Down Expand Up @@ -166,7 +166,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
border: UiRect::all(Val::Px(20.)),
..default()
},
border_color: GREEN.into(),
border_color: LIME.into(),
background_color: Color::srgb(0.4, 0.4, 1.).into(),
..default()
})
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/viewport_debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use bevy::{color::palettes::css::*, prelude::*};

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

#[derive(Component, Default, PartialEq)]
Expand Down
4 changes: 2 additions & 2 deletions examples/ui/z_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! depth of nodes compared to their siblings, but also compared to the entire UI.

use bevy::{
color::palettes::basic::{BLUE, GRAY, GREEN, PURPLE, RED, YELLOW},
color::palettes::basic::{BLUE, GRAY, LIME, PURPLE, RED, YELLOW},
prelude::*,
};

Expand Down Expand Up @@ -79,7 +79,7 @@ fn setup(mut commands: Commands) {
// it will show under other nodes in the gray container.
parent.spawn(NodeBundle {
z_index: ZIndex::Local(-1),
background_color: GREEN.into(),
background_color: LIME.into(),
style: Style {
position_type: PositionType::Absolute,
left: Val::Px(70.0),
Expand Down
4 changes: 2 additions & 2 deletions examples/window/low_power.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fn update_winit(
pub(crate) mod test_setup {
use crate::ExampleMode;
use bevy::{
color::palettes::basic::{GREEN, YELLOW},
color::palettes::basic::{LIME, YELLOW},
prelude::*,
window::RequestRedraw,
};
Expand Down Expand Up @@ -181,7 +181,7 @@ pub(crate) mod test_setup {
),
TextSection::from_style(TextStyle {
font_size: 50.0,
color: GREEN.into(),
color: LIME.into(),
..default()
}),
TextSection::new(
Expand Down

0 comments on commit c630b71

Please sign in to comment.