From 8686330abe420bd20146c5e7eb316d3d2af64265 Mon Sep 17 00:00:00 2001 From: Aevyrie Date: Wed, 1 Nov 2023 15:56:00 -0700 Subject: [PATCH] Update default `ClearColor` --- crates/bevy_core_pipeline/src/clear_color.rs | 3 ++- examples/2d/bloom_2d.rs | 1 - examples/3d/3d_scene.rs | 9 +++++---- examples/3d/atmospheric_fog.rs | 1 - examples/3d/blend_modes.rs | 2 +- examples/3d/bloom_3d.rs | 1 - examples/3d/deferred_rendering.rs | 1 - examples/3d/pbr.rs | 2 -- examples/3d/spherical_area_lights.rs | 1 - examples/3d/ssao.rs | 2 +- examples/3d/tonemapping.rs | 1 - examples/games/contributors.rs | 4 ++-- examples/input/text_input.rs | 14 +++++++------- examples/scene/scene.rs | 1 - examples/shader/shader_prepass.rs | 1 - examples/stress_tests/many_glyphs.rs | 1 - examples/tools/scene_viewer/morph_viewer_plugin.rs | 2 +- examples/ui/display_and_visibility.rs | 4 ++-- examples/ui/grid.rs | 4 ++-- examples/ui/overflow.rs | 2 +- examples/ui/overflow_debug.rs | 4 ++-- examples/ui/text.rs | 4 ++-- examples/ui/text_debug.rs | 2 +- examples/ui/text_wrap_debug.rs | 2 +- examples/ui/ui.rs | 6 +++--- examples/ui/ui_texture_atlas.rs | 1 - examples/ui/window_fallthrough.rs | 2 +- examples/window/low_power.rs | 1 - examples/window/scale_factor_override.rs | 1 - examples/window/screenshot.rs | 1 - examples/window/window_resizing.rs | 1 - 31 files changed, 34 insertions(+), 48 deletions(-) diff --git a/crates/bevy_core_pipeline/src/clear_color.rs b/crates/bevy_core_pipeline/src/clear_color.rs index 0461b6c2c714e..9a51d03bd2d7c 100644 --- a/crates/bevy_core_pipeline/src/clear_color.rs +++ b/crates/bevy_core_pipeline/src/clear_color.rs @@ -29,6 +29,7 @@ pub struct ClearColor(pub Color); impl Default for ClearColor { fn default() -> Self { - Self(Color::rgb(0.4, 0.4, 0.4)) + // Match the bevy website code block color by default. + Self(Color::rgb_u8(43, 44, 47)) } } diff --git a/examples/2d/bloom_2d.rs b/examples/2d/bloom_2d.rs index 108cc94c571f1..ca9095dfc6fbf 100644 --- a/examples/2d/bloom_2d.rs +++ b/examples/2d/bloom_2d.rs @@ -11,7 +11,6 @@ use bevy::{ fn main() { App::new() - .insert_resource(ClearColor(Color::DARK_GRAY)) .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .add_systems(Update, update_bloom_settings) diff --git a/examples/3d/3d_scene.rs b/examples/3d/3d_scene.rs index 9fbbca077cfb7..683613bf8b2bf 100644 --- a/examples/3d/3d_scene.rs +++ b/examples/3d/3d_scene.rs @@ -17,14 +17,15 @@ fn setup( ) { // plane commands.spawn(PbrBundle { - mesh: meshes.add(shape::Plane::from_size(5.0).into()), - material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()), + mesh: meshes.add(shape::Circle::new(4.0).into()), + material: materials.add(Color::WHITE.into()), + transform: Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::FRAC_PI_2)), ..default() }); // cube commands.spawn(PbrBundle { mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })), - material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()), + material: materials.add(Color::rgb_u8(124, 144, 255).into()), transform: Transform::from_xyz(0.0, 0.5, 0.0), ..default() }); @@ -40,7 +41,7 @@ fn setup( }); // camera commands.spawn(Camera3dBundle { - transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y), + transform: Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y), ..default() }); } diff --git a/examples/3d/atmospheric_fog.rs b/examples/3d/atmospheric_fog.rs index b29fc9adabb9b..913ec0aebac0b 100644 --- a/examples/3d/atmospheric_fog.rs +++ b/examples/3d/atmospheric_fog.rs @@ -99,7 +99,6 @@ fn setup_instructions(mut commands: Commands) { "Press Spacebar to Toggle Atmospheric Fog.\nPress S to Toggle Directional Light Fog Influence.", TextStyle { font_size: 20.0, - color: Color::WHITE, ..default() }, ) diff --git a/examples/3d/blend_modes.rs b/examples/3d/blend_modes.rs index 1b6b43059d061..a240584729661 100644 --- a/examples/3d/blend_modes.rs +++ b/examples/3d/blend_modes.rs @@ -188,7 +188,7 @@ fn setup( let text_style = TextStyle { font: asset_server.load("fonts/FiraMono-Medium.ttf"), font_size: 18.0, - color: Color::BLACK, + ..default() }; let label_text_style = TextStyle { diff --git a/examples/3d/bloom_3d.rs b/examples/3d/bloom_3d.rs index 4b68878fcdfc0..396ac0cd1ded9 100644 --- a/examples/3d/bloom_3d.rs +++ b/examples/3d/bloom_3d.rs @@ -14,7 +14,6 @@ use std::{ fn main() { App::new() - .insert_resource(ClearColor(Color::DARK_GRAY)) .add_plugins(DefaultPlugins) .add_systems(Startup, setup_scene) .add_systems(Update, (update_bloom_settings, bounce_spheres)) diff --git a/examples/3d/deferred_rendering.rs b/examples/3d/deferred_rendering.rs index 492d98bd5a52d..f1cf76058b798 100644 --- a/examples/3d/deferred_rendering.rs +++ b/examples/3d/deferred_rendering.rs @@ -216,7 +216,6 @@ fn setup( "", TextStyle { font_size: 18.0, - color: Color::WHITE, ..default() }, ) diff --git a/examples/3d/pbr.rs b/examples/3d/pbr.rs index 305d073a953fb..348fc7d9d5750 100644 --- a/examples/3d/pbr.rs +++ b/examples/3d/pbr.rs @@ -74,7 +74,6 @@ fn setup( "Perceptual Roughness", TextStyle { font_size: 36.0, - color: Color::WHITE, ..default() }, ) @@ -91,7 +90,6 @@ fn setup( "Metallic", TextStyle { font_size: 36.0, - color: Color::WHITE, ..default() }, ), diff --git a/examples/3d/spherical_area_lights.rs b/examples/3d/spherical_area_lights.rs index f8b5d6b93f27f..99dfc14d09eeb 100644 --- a/examples/3d/spherical_area_lights.rs +++ b/examples/3d/spherical_area_lights.rs @@ -4,7 +4,6 @@ use bevy::prelude::*; fn main() { App::new() - .insert_resource(ClearColor(Color::BLACK)) .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .run(); diff --git a/examples/3d/ssao.rs b/examples/3d/ssao.rs index a175900763efd..9253c6afbb64f 100644 --- a/examples/3d/ssao.rs +++ b/examples/3d/ssao.rs @@ -107,7 +107,7 @@ fn setup( TextStyle { font: asset_server.load("fonts/FiraMono-Medium.ttf"), font_size: 26.0, - color: Color::BLACK, + ..default() }, ) .with_style(Style { diff --git a/examples/3d/tonemapping.rs b/examples/3d/tonemapping.rs index df9fcdc2b336b..1e86dca952b3c 100644 --- a/examples/3d/tonemapping.rs +++ b/examples/3d/tonemapping.rs @@ -76,7 +76,6 @@ fn setup( "", TextStyle { font_size: 18.0, - color: Color::WHITE, ..default() }, ) diff --git a/examples/games/contributors.rs b/examples/games/contributors.rs index 4494a241d83b3..4fd8309a2f8f5 100644 --- a/examples/games/contributors.rs +++ b/examples/games/contributors.rs @@ -149,13 +149,13 @@ fn setup(mut commands: Commands, asset_server: Res) { TextStyle { font: asset_server.load("fonts/FiraSans-Bold.ttf"), font_size: 60.0, - color: Color::WHITE, + ..default() }, ), TextSection::from_style(TextStyle { font: asset_server.load("fonts/FiraSans-Bold.ttf"), font_size: 60.0, - color: Color::WHITE, + ..default() }), ]) .with_style(Style { diff --git a/examples/input/text_input.rs b/examples/input/text_input.rs index fa33e3dae8cf1..b6e9ad5b04735 100644 --- a/examples/input/text_input.rs +++ b/examples/input/text_input.rs @@ -39,7 +39,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { style: TextStyle { font: font.clone_weak(), font_size: 20.0, - color: Color::WHITE, + ..default() }, }, TextSection { @@ -47,7 +47,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { style: TextStyle { font: font.clone_weak(), font_size: 30.0, - color: Color::WHITE, + ..default() }, }, TextSection { @@ -55,7 +55,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { style: TextStyle { font: font.clone_weak(), font_size: 20.0, - color: Color::WHITE, + ..default() }, }, TextSection { @@ -63,7 +63,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { style: TextStyle { font: font.clone_weak(), font_size: 30.0, - color: Color::WHITE, + ..default() }, }, TextSection { @@ -71,7 +71,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { style: TextStyle { font: font.clone_weak(), font_size: 18.0, - color: Color::WHITE, + ..default() }, }, TextSection { @@ -79,7 +79,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { style: TextStyle { font, font_size: 25.0, - color: Color::WHITE, + ..default() }, }, ]) @@ -97,7 +97,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { TextStyle { font: asset_server.load("fonts/FiraMono-Medium.ttf"), font_size: 100.0, - color: Color::WHITE, + ..default() }, ), ..default() diff --git a/examples/scene/scene.rs b/examples/scene/scene.rs index 7f3af48996323..7120fd419ff0f 100644 --- a/examples/scene/scene.rs +++ b/examples/scene/scene.rs @@ -151,7 +151,6 @@ fn infotext_system(mut commands: Commands) { "Nothing to see in this window! Check the console output!", TextStyle { font_size: 50.0, - color: Color::WHITE, ..default() }, ) diff --git a/examples/shader/shader_prepass.rs b/examples/shader/shader_prepass.rs index e2159f4277d34..d3faa9f9fe457 100644 --- a/examples/shader/shader_prepass.rs +++ b/examples/shader/shader_prepass.rs @@ -135,7 +135,6 @@ fn setup( let style = TextStyle { font_size: 18.0, - color: Color::WHITE, ..default() }; diff --git a/examples/stress_tests/many_glyphs.rs b/examples/stress_tests/many_glyphs.rs index 398ac3cb64f9b..d4b18507cd1a9 100644 --- a/examples/stress_tests/many_glyphs.rs +++ b/examples/stress_tests/many_glyphs.rs @@ -43,7 +43,6 @@ fn setup(mut commands: Commands) { value: "0123456789".repeat(10_000), style: TextStyle { font_size: 4., - color: Color::WHITE, ..default() }, }], diff --git a/examples/tools/scene_viewer/morph_viewer_plugin.rs b/examples/tools/scene_viewer/morph_viewer_plugin.rs index b82bef0f20dda..dedd9568631c1 100644 --- a/examples/tools/scene_viewer/morph_viewer_plugin.rs +++ b/examples/tools/scene_viewer/morph_viewer_plugin.rs @@ -257,7 +257,7 @@ fn detect_morphs( let style = TextStyle { font: asset_server.load("assets/fonts/FiraMono-Medium.ttf"), font_size: 13.0, - color: Color::WHITE, + ..default() }; let mut sections = vec![ TextSection::new("Morph Target Controls\n", style.clone()), diff --git a/examples/ui/display_and_visibility.rs b/examples/ui/display_and_visibility.rs index 37cd9eea6e968..216146e19f9ee 100644 --- a/examples/ui/display_and_visibility.rs +++ b/examples/ui/display_and_visibility.rs @@ -76,7 +76,7 @@ fn setup(mut commands: Commands, asset_server: Res) { let text_style = TextStyle { font: asset_server.load("fonts/FiraSans-Bold.ttf"), font_size: 24.0, - color: Color::WHITE, + ..default() }; commands.spawn(Camera2dBundle::default()); @@ -151,7 +151,7 @@ fn setup(mut commands: Commands, asset_server: Res) { let text_style = TextStyle { font: asset_server.load("fonts/FiraSans-Bold.ttf"), font_size: 20.0, - color: Color::WHITE, + ..default() }; builder.spawn(TextBundle { diff --git a/examples/ui/grid.rs b/examples/ui/grid.rs index af961b0daf6de..12a2efba16576 100644 --- a/examples/ui/grid.rs +++ b/examples/ui/grid.rs @@ -144,7 +144,7 @@ fn spawn_layout(mut commands: Commands, asset_server: Res) { TextStyle { font: font.clone(), font_size: 24.0, - color: Color::WHITE, + ..default() }, )); builder.spawn(TextBundle::from_section( @@ -152,7 +152,7 @@ fn spawn_layout(mut commands: Commands, asset_server: Res) { TextStyle { font: font.clone(), font_size: 16.0, - color: Color::WHITE, + ..default() }, )); builder.spawn(NodeBundle::default()); diff --git a/examples/ui/overflow.rs b/examples/ui/overflow.rs index a6d20d8b27e0a..433456f6a9d0e 100644 --- a/examples/ui/overflow.rs +++ b/examples/ui/overflow.rs @@ -17,7 +17,7 @@ fn setup(mut commands: Commands, asset_server: Res) { let text_style = TextStyle { font: asset_server.load("fonts/FiraMono-Medium.ttf"), font_size: 20.0, - color: Color::WHITE, + ..default() }; let image = asset_server.load("branding/icon.png"); diff --git a/examples/ui/overflow_debug.rs b/examples/ui/overflow_debug.rs index 34f54df3c33a1..2cf1470c70f05 100644 --- a/examples/ui/overflow_debug.rs +++ b/examples/ui/overflow_debug.rs @@ -110,7 +110,7 @@ fn setup(mut commands: Commands, asset_server: Res) { TextStyle { font: asset_server.load("fonts/FiraSans-Bold.ttf"), font_size: 18.0, - color: Color::WHITE, + ..default() }, )); }); @@ -185,7 +185,7 @@ fn spawn_text( TextStyle { font: asset_server.load("fonts/FiraSans-Bold.ttf"), font_size: 120.0, - color: Color::WHITE, + ..default() }, )); }); diff --git a/examples/ui/text.rs b/examples/ui/text.rs index c66e472ffd47b..30c4f9633cbe5 100644 --- a/examples/ui/text.rs +++ b/examples/ui/text.rs @@ -37,7 +37,7 @@ fn setup(mut commands: Commands, asset_server: Res) { // This font is loaded and will be used instead of the default font. font: asset_server.load("fonts/FiraSans-Bold.ttf"), font_size: 100.0, - color: Color::WHITE, + ..default() }, ) // Set the alignment of the Text .with_text_alignment(TextAlignment::Center) @@ -61,7 +61,7 @@ fn setup(mut commands: Commands, asset_server: Res) { // This font is loaded and will be used instead of the default font. font: asset_server.load("fonts/FiraSans-Bold.ttf"), font_size: 60.0, - color: Color::WHITE, + ..default() }, ), TextSection::from_style(if cfg!(feature = "default_font") { diff --git a/examples/ui/text_debug.rs b/examples/ui/text_debug.rs index cfacced41c421..15229bb2820b1 100644 --- a/examples/ui/text_debug.rs +++ b/examples/ui/text_debug.rs @@ -35,7 +35,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res) { TextStyle { font: font.clone(), font_size: 50.0, - color: Color::WHITE, + ..default() }, ) .with_style(Style { diff --git a/examples/ui/text_wrap_debug.rs b/examples/ui/text_wrap_debug.rs index 1ff439d6bdf5d..d1d9c1af40d5d 100644 --- a/examples/ui/text_wrap_debug.rs +++ b/examples/ui/text_wrap_debug.rs @@ -46,7 +46,7 @@ fn spawn(mut commands: Commands, asset_server: Res) { let text_style = TextStyle { font: asset_server.load("fonts/FiraSans-Bold.ttf"), font_size: 14.0, - color: Color::WHITE, + ..default() }; let root = commands diff --git a/examples/ui/ui.rs b/examples/ui/ui.rs index 3eabcdd15604d..21817b62e7f76 100644 --- a/examples/ui/ui.rs +++ b/examples/ui/ui.rs @@ -66,7 +66,7 @@ fn setup(mut commands: Commands, asset_server: Res) { TextStyle { font: asset_server.load("fonts/FiraSans-Bold.ttf"), font_size: 30.0, - color: Color::WHITE, + ..default() }, ) .with_style(Style { @@ -101,7 +101,7 @@ fn setup(mut commands: Commands, asset_server: Res) { TextStyle { font: asset_server.load("fonts/FiraSans-Bold.ttf"), font_size: 25., - color: Color::WHITE, + ..default() }, ), Label, @@ -144,7 +144,7 @@ fn setup(mut commands: Commands, asset_server: Res) { font: asset_server .load("fonts/FiraSans-Bold.ttf"), font_size: 20., - color: Color::WHITE, + ..default() }, ), Label, diff --git a/examples/ui/ui_texture_atlas.rs b/examples/ui/ui_texture_atlas.rs index 8609288bf790a..dbab05c02d6f6 100644 --- a/examples/ui/ui_texture_atlas.rs +++ b/examples/ui/ui_texture_atlas.rs @@ -26,7 +26,6 @@ fn setup( commands.spawn(Camera2dBundle::default()); let text_style = TextStyle { - color: Color::ANTIQUE_WHITE, font_size: 20., ..default() }; diff --git a/examples/ui/window_fallthrough.rs b/examples/ui/window_fallthrough.rs index daf744aeae5ee..5fbd7eadce809 100644 --- a/examples/ui/window_fallthrough.rs +++ b/examples/ui/window_fallthrough.rs @@ -34,7 +34,7 @@ fn setup(mut commands: Commands, asset_server: Res) { TextStyle { font: asset_server.load("fonts/FiraSans-Bold.ttf"), font_size: 100.0, // Nice and big so you can see it! - color: Color::WHITE, + ..default() }, ) // Set the style of the TextBundle itself. diff --git a/examples/window/low_power.rs b/examples/window/low_power.rs index d64f9d36412b6..527297c8923bb 100644 --- a/examples/window/low_power.rs +++ b/examples/window/low_power.rs @@ -177,7 +177,6 @@ pub(crate) mod test_setup { "Press spacebar to cycle modes\n", TextStyle { font_size: 50.0, - color: Color::WHITE, ..default() }, ), diff --git a/examples/window/scale_factor_override.rs b/examples/window/scale_factor_override.rs index bfa74cfe116dd..d871352a41180 100644 --- a/examples/window/scale_factor_override.rs +++ b/examples/window/scale_factor_override.rs @@ -53,7 +53,6 @@ fn setup(mut commands: Commands) { "Example text", TextStyle { font_size: 30.0, - color: Color::WHITE, ..default() }, ) diff --git a/examples/window/screenshot.rs b/examples/window/screenshot.rs index 4b9eda146d813..340dadd72b022 100644 --- a/examples/window/screenshot.rs +++ b/examples/window/screenshot.rs @@ -67,7 +67,6 @@ fn setup( "Press to save a screenshot to disk", TextStyle { font_size: 25.0, - color: Color::WHITE, ..default() }, ) diff --git a/examples/window/window_resizing.rs b/examples/window/window_resizing.rs index 35c7c6d17937c..d0a81a26a95b7 100644 --- a/examples/window/window_resizing.rs +++ b/examples/window/window_resizing.rs @@ -48,7 +48,6 @@ fn setup_ui(mut cmd: Commands) { "Resolution", TextStyle { font_size: 50.0, - color: Color::BLACK, ..default() }, ),