Skip to content

Commit

Permalink
Re-export basic color palette via css color palette (#12172)
Browse files Browse the repository at this point in the history
# Objective

The `css` contains all of the `basic` colors. Rather than defining them
twice, we can re-export them.

Suggested by @viridia <3

## Solution

- Re-export basic color palette within the css color palette.
- Remove the duplicate colors
- Fix alphabetization of the basic color palette file while I'm here

---------

Co-authored-by: Alice Cecile <[email protected]>
  • Loading branch information
alice-i-cecile and Alice Cecile authored Feb 28, 2024
1 parent 6774e04 commit c2ae51d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 32 deletions.
4 changes: 2 additions & 2 deletions crates/bevy_color/src/palettes/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ pub const BLACK: Srgba = Srgba::new(0.0, 0.0, 0.0, 1.0);
pub const BLUE: Srgba = Srgba::new(0.0, 0.0, 1.0, 1.0);
/// <div style="background-color:rgb(0%, 100%, 100%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const CYAN: Srgba = Srgba::new(0.0, 1.0, 1.0, 1.0);
/// <div style="background-color:rgb(0%, 50%, 0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const GREEN: Srgba = Srgba::new(0.0, 0.5, 0.0, 1.0);
/// <div style="background-color:rgb(100%, 0%, 100%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const FUCHSIA: Srgba = Srgba::new(1.0, 0.0, 1.0, 1.0);
/// <div style="background-color:rgb(50%, 50%, 50%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const GRAY: Srgba = Srgba::new(0.5, 0.5, 0.5, 1.0);
/// <div style="background-color:rgb(0%, 50%, 0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const GREEN: Srgba = Srgba::new(0.0, 0.5, 0.0, 1.0);
/// <div style="background-color:rgb(0%, 100%, 0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const LIME: Srgba = Srgba::new(0.0, 1.0, 0.0, 1.0);
/// <div style="background-color:rgb(50%, 0%, 0%); width: 10px; padding: 10px; border: 1px solid;"></div>
Expand Down
34 changes: 4 additions & 30 deletions crates/bevy_color/src/palettes/css.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
use crate::Srgba;

// The CSS4 colors are a superset of the CSS1 colors, so we can just re-export the CSS1 colors.
#[allow(unused_imports)]
pub use crate::palettes::basic::*;

/// <div style="background-color:rgb(94.1%, 97.3%, 100.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const ALICE_BLUE: Srgba = Srgba::new(0.941, 0.973, 1.0, 1.0);
/// <div style="background-color:rgb(98.0%, 92.2%, 84.3%); width: 10px; padding: 10px; border: 1px solid;"></div>
Expand All @@ -17,12 +21,8 @@ pub const AZURE: Srgba = Srgba::new(0.941, 1.0, 1.0, 1.0);
pub const BEIGE: Srgba = Srgba::new(0.961, 0.961, 0.863, 1.0);
/// <div style="background-color:rgb(100.0%, 89.4%, 76.9%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const BISQUE: Srgba = Srgba::new(1.0, 0.894, 0.769, 1.0);
/// <div style="background-color:rgb(0.0%, 0.0%, 0.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const BLACK: Srgba = Srgba::new(0.0, 0.0, 0.0, 1.0);
/// <div style="background-color:rgb(100.0%, 92.2%, 80.4%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const BLANCHED_ALMOND: Srgba = Srgba::new(1.0, 0.922, 0.804, 1.0);
/// <div style="background-color:rgb(0.0%, 0.0%, 100.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const BLUE: Srgba = Srgba::new(0.0, 0.0, 1.0, 1.0);
/// <div style="background-color:rgb(54.1%, 16.900000000000002%, 88.6%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const BLUE_VIOLET: Srgba = Srgba::new(0.541, 0.169, 0.886, 1.0);
/// <div style="background-color:rgb(64.7%, 16.5%, 16.5%); width: 10px; padding: 10px; border: 1px solid;"></div>
Expand All @@ -43,8 +43,6 @@ pub const CORNFLOWER_BLUE: Srgba = Srgba::new(0.392, 0.584, 0.929, 1.0);
pub const CORNSILK: Srgba = Srgba::new(1.0, 0.973, 0.863, 1.0);
/// <div style="background-color:rgb(86.3%, 7.8%, 23.5%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const CRIMSON: Srgba = Srgba::new(0.863, 0.078, 0.235, 1.0);
/// <div style="background-color:rgb(0.0%, 100.0%, 100.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const CYAN: Srgba = Srgba::new(0.0, 1.0, 1.0, 1.0);
/// <div style="background-color:rgb(0.0%, 0.0%, 54.50000000000001%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const DARK_BLUE: Srgba = Srgba::new(0.0, 0.0, 0.545, 1.0);
/// <div style="background-color:rgb(0.0%, 54.50000000000001%, 54.50000000000001%); width: 10px; padding: 10px; border: 1px solid;"></div>
Expand Down Expand Up @@ -99,8 +97,6 @@ pub const FIRE_BRICK: Srgba = Srgba::new(0.698, 0.133, 0.133, 1.0);
pub const FLORAL_WHITE: Srgba = Srgba::new(1.0, 0.98, 0.941, 1.0);
/// <div style="background-color:rgb(13.3%, 54.50000000000001%, 13.3%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const FOREST_GREEN: Srgba = Srgba::new(0.133, 0.545, 0.133, 1.0);
/// <div style="background-color:rgb(100.0%, 0.0%, 100.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const FUCHSIA: Srgba = Srgba::new(1.0, 0.0, 1.0, 1.0);
/// <div style="background-color:rgb(86.3%, 86.3%, 86.3%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const GAINSBORO: Srgba = Srgba::new(0.863, 0.863, 0.863, 1.0);
/// <div style="background-color:rgb(97.3%, 97.3%, 100.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
Expand All @@ -109,8 +105,6 @@ pub const GHOST_WHITE: Srgba = Srgba::new(0.973, 0.973, 1.0, 1.0);
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(50.2%, 50.2%, 50.2%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const GRAY: Srgba = Srgba::new(0.502, 0.502, 0.502, 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>
Expand Down Expand Up @@ -167,16 +161,12 @@ pub const LIGHT_SLATE_GREY: Srgba = Srgba::new(0.467, 0.533, 0.6, 1.0);
pub const LIGHT_STEEL_BLUE: Srgba = Srgba::new(0.69, 0.769, 0.871, 1.0);
/// <div style="background-color:rgb(100.0%, 100.0%, 87.8%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const LIGHT_YELLOW: Srgba = Srgba::new(1.0, 1.0, 0.878, 1.0);
/// <div style="background-color:rgb(0.0%, 100.0%, 0.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const LIME: Srgba = Srgba::new(0.0, 1.0, 0.0, 1.0);
/// <div style="background-color:rgb(19.6%, 80.4%, 19.6%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const LIMEGREEN: Srgba = Srgba::new(0.196, 0.804, 0.196, 1.0);
/// <div style="background-color:rgb(98.0%, 94.1%, 90.2%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const LINEN: Srgba = Srgba::new(0.98, 0.941, 0.902, 1.0);
/// <div style="background-color:rgb(100.0%, 0.0%, 100.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const MAGENTA: Srgba = Srgba::new(1.0, 0.0, 1.0, 1.0);
/// <div style="background-color:rgb(50.2%, 0.0%, 0.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const MAROON: Srgba = Srgba::new(0.502, 0.0, 0.0, 1.0);
/// <div style="background-color:rgb(40.0%, 80.4%, 66.7%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const MEDIUM_AQUAMARINE: Srgba = Srgba::new(0.4, 0.804, 0.667, 1.0);
/// <div style="background-color:rgb(0.0%, 0.0%, 80.4%); width: 10px; padding: 10px; border: 1px solid;"></div>
Expand Down Expand Up @@ -205,12 +195,8 @@ pub const MISTY_ROSE: Srgba = Srgba::new(1.0, 0.894, 0.882, 1.0);
pub const MOCCASIN: Srgba = Srgba::new(1.0, 0.894, 0.71, 1.0);
/// <div style="background-color:rgb(100.0%, 87.1%, 67.80000000000001%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const NAVAJO_WHITE: Srgba = Srgba::new(1.0, 0.871, 0.678, 1.0);
/// <div style="background-color:rgb(0.0%, 0.0%, 50.2%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const NAVY: Srgba = Srgba::new(0.0, 0.0, 0.502, 1.0);
/// <div style="background-color:rgb(99.2%, 96.1%, 90.2%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const OLD_LACE: Srgba = Srgba::new(0.992, 0.961, 0.902, 1.0);
/// <div style="background-color:rgb(50.2%, 50.2%, 0.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const OLIVE: Srgba = Srgba::new(0.502, 0.502, 0.0, 1.0);
/// <div style="background-color:rgb(42.0%, 55.7%, 13.700000000000001%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const OLIVE_DRAB: Srgba = Srgba::new(0.42, 0.557, 0.137, 1.0);
/// <div style="background-color:rgb(100.0%, 64.7%, 0.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
Expand Down Expand Up @@ -239,12 +225,8 @@ pub const PINK: Srgba = Srgba::new(1.0, 0.753, 0.796, 1.0);
pub const PLUM: Srgba = Srgba::new(0.867, 0.627, 0.867, 1.0);
/// <div style="background-color:rgb(69.0%, 87.8%, 90.2%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const POWDER_BLUE: Srgba = Srgba::new(0.69, 0.878, 0.902, 1.0);
/// <div style="background-color:rgb(50.2%, 0.0%, 50.2%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const PURPLE: Srgba = Srgba::new(0.502, 0.0, 0.502, 1.0);
/// <div style="background-color:rgb(40.0%, 20.0%, 60.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const REBECCA_PURPLE: Srgba = Srgba::new(0.4, 0.2, 0.6, 1.0);
/// <div style="background-color:rgb(100.0%, 0.0%, 0.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const RED: Srgba = Srgba::new(1.0, 0.0, 0.0, 1.0);
/// <div style="background-color:rgb(73.7%, 56.10000000000001%, 56.10000000000001%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const ROSY_BROWN: Srgba = Srgba::new(0.737, 0.561, 0.561, 1.0);
/// <div style="background-color:rgb(25.5%, 41.199999999999996%, 88.2%); width: 10px; padding: 10px; border: 1px solid;"></div>
Expand All @@ -261,8 +243,6 @@ pub const SEA_GREEN: Srgba = Srgba::new(0.18, 0.545, 0.341, 1.0);
pub const SEASHELL: Srgba = Srgba::new(1.0, 0.961, 0.933, 1.0);
/// <div style="background-color:rgb(62.7%, 32.2%, 17.599999999999998%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const SIENNA: Srgba = Srgba::new(0.627, 0.322, 0.176, 1.0);
/// <div style="background-color:rgb(75.3%, 75.3%, 75.3%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const SILVER: Srgba = Srgba::new(0.753, 0.753, 0.753, 1.0);
/// <div style="background-color:rgb(52.900000000000006%, 80.80000000000001%, 92.2%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const SKY_BLUE: Srgba = Srgba::new(0.529, 0.808, 0.922, 1.0);
/// <div style="background-color:rgb(41.6%, 35.3%, 80.4%); width: 10px; padding: 10px; border: 1px solid;"></div>
Expand All @@ -279,8 +259,6 @@ pub const SPRING_GREEN: Srgba = Srgba::new(0.0, 1.0, 0.498, 1.0);
pub const STEEL_BLUE: Srgba = Srgba::new(0.275, 0.51, 0.706, 1.0);
/// <div style="background-color:rgb(82.39999999999999%, 70.6%, 54.900000000000006%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const TAN: Srgba = Srgba::new(0.824, 0.706, 0.549, 1.0);
/// <div style="background-color:rgb(0.0%, 50.2%, 50.2%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const TEAL: Srgba = Srgba::new(0.0, 0.502, 0.502, 1.0);
/// <div style="background-color:rgb(84.7%, 74.9%, 84.7%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const THISTLE: Srgba = Srgba::new(0.847, 0.749, 0.847, 1.0);
/// <div style="background-color:rgb(100.0%, 38.800000000000004%, 27.800000000000004%); width: 10px; padding: 10px; border: 1px solid;"></div>
Expand All @@ -291,11 +269,7 @@ pub const TURQUOISE: Srgba = Srgba::new(0.251, 0.878, 0.816, 1.0);
pub const VIOLET: Srgba = Srgba::new(0.933, 0.51, 0.933, 1.0);
/// <div style="background-color:rgb(96.1%, 87.1%, 70.19999999999999%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const WHEAT: Srgba = Srgba::new(0.961, 0.871, 0.702, 1.0);
/// <div style="background-color:rgb(100.0%, 100.0%, 100.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const WHITE: Srgba = Srgba::new(1.0, 1.0, 1.0, 1.0);
/// <div style="background-color:rgb(96.1%, 96.1%, 96.1%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const WHITE_SMOKE: Srgba = Srgba::new(0.961, 0.961, 0.961, 1.0);
/// <div style="background-color:rgb(100.0%, 100.0%, 0.0%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const YELLOW: Srgba = Srgba::new(1.0, 1.0, 0.0, 1.0);
/// <div style="background-color:rgb(60.4%, 80.4%, 19.6%); width: 10px; padding: 10px; border: 1px solid;"></div>
pub const YELLOW_GREEN: Srgba = Srgba::new(0.604, 0.804, 0.196, 1.0);

0 comments on commit c2ae51d

Please sign in to comment.