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.
This commit is contained in:
Rob Parrett 2024-03-05 16:42:03 -07:00 committed by GitHub
parent ba9d1eff41
commit 0746b8eb4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 34 additions and 42 deletions

View file

@ -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);

View file

@ -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);
}
}
}
@ -359,7 +355,7 @@ fn aabb_cast_system(
+ aabb_cast.aabb.center(),
0.,
aabb_cast.aabb.half_size() * 2.,
GREEN,
LIME,
);
}
}
@ -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,
);
}
}

View file

@ -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)),
] {

View file

@ -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,
@ -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()
}),

View file

@ -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::*,
};
@ -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()
},

View file

@ -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,

View file

@ -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
@ -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()
};
}
}

View file

@ -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()
},

View file

@ -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::*,
};
@ -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()
});

View file

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

View file

@ -116,7 +116,7 @@ mod splash {
mod game {
use bevy::{
color::palettes::basic::{BLUE, GREEN},
color::palettes::basic::{BLUE, LIME},
prelude::*,
};
@ -211,7 +211,7 @@ mod game {
format!("volume: {:?}", *volume),
TextStyle {
font_size: 60.0,
color: GREEN.into(),
color: LIME.into(),
..default()
},
),

View file

@ -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(
@ -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),
]);

View file

@ -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);

View file

@ -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,

View file

@ -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",

View file

@ -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,
@ -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()
})

View file

@ -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)]

View file

@ -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::*,
};
@ -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),

View file

@ -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,
};
@ -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(