Skip to content

Commit

Permalink
Fix "dark grey" colors becoming lighter in various examples (#12333)
Browse files Browse the repository at this point in the history
# Objective

Fixes #12226

Prior to the `bevy_color` port, `DARK GRAY` used to mean "dark grey."
But it is now lighter than `GRAY`, matching the css4 spec.

## Solution

Change usages of `css::DARK_GRAY` to `Color::srgb(0.25, 0.25, 0.25)` to
restore the examples to their former colors.

With one exception: `display_and_visibility`. I think the new color is
an improvement.

## Note

A lot of these examples could use nicer colors. I'm not trying to revamp
everything here.

The css4 palette is truly a horror. See #12176 and #12080 for some
discussion about alternatives.
  • Loading branch information
rparrett authored Mar 6, 2024
1 parent 0746b8e commit d56e167
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
5 changes: 2 additions & 3 deletions examples/3d/split_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
use std::f32::consts::PI;

use bevy::{
color::palettes::css::DARK_GRAY, pbr::CascadeShadowConfigBuilder, prelude::*,
render::camera::Viewport, window::WindowResized,
pbr::CascadeShadowConfigBuilder, prelude::*, render::camera::Viewport, window::WindowResized,
};

fn main() {
Expand Down Expand Up @@ -147,7 +146,7 @@ fn setup(
..default()
},
border_color: Color::WHITE.into(),
image: UiImage::default().with_color(DARK_GRAY.into()),
image: UiImage::default().with_color(Color::srgb(0.25, 0.25, 0.25)),
..default()
},
))
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/borders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn setup(mut commands: Commands) {
align_content: AlignContent::FlexStart,
..Default::default()
},
background_color: DARK_GRAY.into(),
background_color: Color::srgb(0.25, 0.25, 0.25).into(),
..Default::default()
})
.id();
Expand Down
4 changes: 2 additions & 2 deletions examples/ui/flex_layout.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Demonstrates how the `AlignItems` and `JustifyContent` properties can be composed to layout text.
use bevy::{color::palettes::css::DARK_GRAY, prelude::*};
use bevy::prelude::*;

const ALIGN_ITEMS_COLOR: Color = Color::srgb(1., 0.066, 0.349);
const JUSTIFY_CONTENT_COLOR: Color = Color::srgb(0.102, 0.522, 1.);
Expand Down Expand Up @@ -134,7 +134,7 @@ fn spawn_child_node(
height: Val::Percent(100.),
..Default::default()
},
background_color: BackgroundColor(DARK_GRAY.into()),
background_color: BackgroundColor(Color::srgb(0.25, 0.25, 0.25)),
..Default::default()
})
.with_children(|builder| {
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn spawn_layout(mut commands: Commands, asset_server: Res<AssetServer>) {
column_gap: Val::Px(12.0),
..default()
},
background_color: BackgroundColor(DARK_GRAY.into()),
background_color: BackgroundColor(Color::srgb(0.25, 0.25, 0.25)),
..default()
})
.with_children(|builder| {
Expand Down
2 changes: 1 addition & 1 deletion examples/ui/overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
margin: UiRect::bottom(Val::Px(25.)),
..Default::default()
},
background_color: DARK_GRAY.into(),
background_color: Color::srgb(0.25, 0.25, 0.25).into(),
..Default::default()
})
.with_children(|parent| {
Expand Down
6 changes: 2 additions & 4 deletions examples/ui/overflow_debug.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Tests how different transforms behave when clipped with `Overflow::Hidden`
use bevy::{
color::palettes::css::DARK_GRAY, input::common_conditions::input_just_pressed, prelude::*,
};
use bevy::{input::common_conditions::input_just_pressed, prelude::*};
use std::f32::consts::{FRAC_PI_2, PI, TAU};

const CONTAINER_SIZE: f32 = 150.0;
Expand Down Expand Up @@ -198,7 +196,7 @@ fn spawn_container(
overflow: Overflow::clip(),
..default()
},
background_color: DARK_GRAY.into(),
background_color: Color::srgb(0.25, 0.25, 0.25).into(),
..default()
},
Container(0),
Expand Down

0 comments on commit d56e167

Please sign in to comment.