Skip to content

Commit

Permalink
Update default ClearColor to better match Bevy's branding (bevyengi…
Browse files Browse the repository at this point in the history
…ne#10339)

# Objective

- Changes the default clear color to match the code block color on
Bevy's website.

## Solution

- Changed the clear color, updated text in examples to ensure adequate
contrast. Inconsistent usage of white text color set to use the default
color instead, which is already white.
- Additionally, updated the `3d_scene` example to make it look a bit
better, and use bevy's branding colors.


![image](https://github.com/bevyengine/bevy/assets/2632925/540a22c0-826c-4c33-89aa-34905e3e313a)
  • Loading branch information
aevyrie authored Nov 3, 2023
1 parent c376954 commit 1918608
Show file tree
Hide file tree
Showing 40 changed files with 234 additions and 96 deletions.
Binary file added assets/branding/bevy_bird_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
135 changes: 135 additions & 0 deletions assets/branding/bevy_bird_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion crates/bevy_core_pipeline/src/clear_color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ pub enum ClearColorConfig {
#[reflect(Resource)]
pub struct ClearColor(pub Color);

/// Match the dark gray bevy website code block color by default.
impl Default for ClearColor {
fn default() -> Self {
Self(Color::rgb(0.4, 0.4, 0.4))
Self(Color::rgb_u8(43, 44, 47))
}
}
1 change: 1 addition & 0 deletions example_showcase_config.ron
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(exit_after: Some(250))
3 changes: 1 addition & 2 deletions examples/2d/bloom_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -38,7 +37,7 @@ fn setup(

// Sprite
commands.spawn(SpriteBundle {
texture: asset_server.load("branding/icon.png"),
texture: asset_server.load("branding/bevy_bird_light.png"),
sprite: Sprite {
color: Color::rgb(5.0, 5.0, 5.0), // 4. Put something bright in a dark environment to see the effect
custom_size: Some(Vec2::splat(160.0)),
Expand Down
2 changes: 1 addition & 1 deletion examples/2d/sprite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn main() {
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2dBundle::default());
commands.spawn(SpriteBundle {
texture: asset_server.load("branding/icon.png"),
texture: asset_server.load("branding/bevy_bird_light.png"),
..default()
});
}
2 changes: 1 addition & 1 deletion examples/2d/sprite_flipping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn main() {
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2dBundle::default());
commands.spawn(SpriteBundle {
texture: asset_server.load("branding/icon.png"),
texture: asset_server.load("branding/bevy_bird_light.png"),
sprite: Sprite {
// Flip the logo to the left
flip_x: true,
Expand Down
11 changes: 6 additions & 5 deletions examples/3d/3d_scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ fn setup(
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
) {
// plane
// circular base
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()
});
Expand All @@ -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()
});
}
16 changes: 14 additions & 2 deletions examples/3d/anti_aliasing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ 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::Plane::from_size(50.0).into()),
material: materials.add(Color::GRAY.into()),
..default()
});

Expand Down Expand Up @@ -325,6 +325,18 @@ fn setup(
enabled: false,
..default()
},
EnvironmentMapLight {
diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
},
FogSettings {
color: Color::rgba_u8(43, 44, 47, 255),
falloff: FogFalloff::Linear {
start: 1.0,
end: 4.0,
},
..default()
},
));

// example instructions
Expand Down
1 change: 0 additions & 1 deletion examples/3d/atmospheric_fog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
},
)
Expand Down
2 changes: 1 addition & 1 deletion examples/3d/blend_modes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion examples/3d/bloom_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
7 changes: 3 additions & 4 deletions examples/3d/deferred_rendering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn setup(
..default()
},
FogSettings {
color: Color::rgba(0.25, 0.25, 0.25, 1.0),
color: Color::rgba_u8(43, 44, 47, 255),
falloff: FogFalloff::Linear {
start: 1.0,
end: 8.0,
Expand Down Expand Up @@ -93,11 +93,11 @@ fn setup(
});
commands.spawn(SceneBundle {
scene: helmet_scene,
transform: Transform::from_xyz(-3.0, 0.0, -3.0),
transform: Transform::from_xyz(-4.0, 0.0, -3.0),
..default()
});

let mut forward_mat: StandardMaterial = Color::rgb(0.1, 0.2, 0.1).into();
let mut forward_mat: StandardMaterial = Color::GRAY.into();
forward_mat.opaque_render_method = OpaqueRendererMethod::Forward;
let forward_mat_h = materials.add(forward_mat);

Expand Down Expand Up @@ -216,7 +216,6 @@ fn setup(
"",
TextStyle {
font_size: 18.0,
color: Color::WHITE,
..default()
},
)
Expand Down
4 changes: 0 additions & 4 deletions examples/3d/load_gltf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ use std::f32::consts::*;

fn main() {
App::new()
.insert_resource(AmbientLight {
color: Color::WHITE,
brightness: 1.0 / 5.0f32,
})
.insert_resource(DirectionalLightShadowMap { size: 4096 })
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
Expand Down
2 changes: 0 additions & 2 deletions examples/3d/pbr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ fn setup(
"Perceptual Roughness",
TextStyle {
font_size: 36.0,
color: Color::WHITE,
..default()
},
)
Expand All @@ -91,7 +90,6 @@ fn setup(
"Metallic",
TextStyle {
font_size: 36.0,
color: Color::WHITE,
..default()
},
),
Expand Down
1 change: 0 additions & 1 deletion examples/3d/spherical_area_lights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use bevy::prelude::*;

fn main() {
App::new()
.insert_resource(ClearColor(Color::BLACK))
.add_plugins(DefaultPlugins)
.add_systems(Startup, setup)
.run();
Expand Down
Loading

0 comments on commit 1918608

Please sign in to comment.