Skip to content

Commit d56e167

Browse files
authored
Fix "dark grey" colors becoming lighter in various examples (#12333)
# 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.
1 parent 0746b8e commit d56e167

File tree

6 files changed

+9
-12
lines changed

6 files changed

+9
-12
lines changed

examples/3d/split_screen.rs

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

55
use bevy::{
6-
color::palettes::css::DARK_GRAY, pbr::CascadeShadowConfigBuilder, prelude::*,
7-
render::camera::Viewport, window::WindowResized,
6+
pbr::CascadeShadowConfigBuilder, prelude::*, render::camera::Viewport, window::WindowResized,
87
};
98

109
fn main() {
@@ -147,7 +146,7 @@ fn setup(
147146
..default()
148147
},
149148
border_color: Color::WHITE.into(),
150-
image: UiImage::default().with_color(DARK_GRAY.into()),
149+
image: UiImage::default().with_color(Color::srgb(0.25, 0.25, 0.25)),
151150
..default()
152151
},
153152
))

examples/ui/borders.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn setup(mut commands: Commands) {
2323
align_content: AlignContent::FlexStart,
2424
..Default::default()
2525
},
26-
background_color: DARK_GRAY.into(),
26+
background_color: Color::srgb(0.25, 0.25, 0.25).into(),
2727
..Default::default()
2828
})
2929
.id();

examples/ui/flex_layout.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Demonstrates how the `AlignItems` and `JustifyContent` properties can be composed to layout text.
2-
use bevy::{color::palettes::css::DARK_GRAY, prelude::*};
2+
use bevy::prelude::*;
33

44
const ALIGN_ITEMS_COLOR: Color = Color::srgb(1., 0.066, 0.349);
55
const JUSTIFY_CONTENT_COLOR: Color = Color::srgb(0.102, 0.522, 1.);
@@ -134,7 +134,7 @@ fn spawn_child_node(
134134
height: Val::Percent(100.),
135135
..Default::default()
136136
},
137-
background_color: BackgroundColor(DARK_GRAY.into()),
137+
background_color: BackgroundColor(Color::srgb(0.25, 0.25, 0.25)),
138138
..Default::default()
139139
})
140140
.with_children(|builder| {

examples/ui/grid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn spawn_layout(mut commands: Commands, asset_server: Res<AssetServer>) {
8787
column_gap: Val::Px(12.0),
8888
..default()
8989
},
90-
background_color: BackgroundColor(DARK_GRAY.into()),
90+
background_color: BackgroundColor(Color::srgb(0.25, 0.25, 0.25)),
9191
..default()
9292
})
9393
.with_children(|builder| {

examples/ui/overflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
6161
margin: UiRect::bottom(Val::Px(25.)),
6262
..Default::default()
6363
},
64-
background_color: DARK_GRAY.into(),
64+
background_color: Color::srgb(0.25, 0.25, 0.25).into(),
6565
..Default::default()
6666
})
6767
.with_children(|parent| {

examples/ui/overflow_debug.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Tests how different transforms behave when clipped with `Overflow::Hidden`
2-
use bevy::{
3-
color::palettes::css::DARK_GRAY, input::common_conditions::input_just_pressed, prelude::*,
4-
};
2+
use bevy::{input::common_conditions::input_just_pressed, prelude::*};
53
use std::f32::consts::{FRAC_PI_2, PI, TAU};
64

75
const CONTAINER_SIZE: f32 = 150.0;
@@ -198,7 +196,7 @@ fn spawn_container(
198196
overflow: Overflow::clip(),
199197
..default()
200198
},
201-
background_color: DARK_GRAY.into(),
199+
background_color: Color::srgb(0.25, 0.25, 0.25).into(),
202200
..default()
203201
},
204202
Container(0),

0 commit comments

Comments
 (0)