Skip to content

Commit

Permalink
Use CSS palette more for basic colors
Browse files Browse the repository at this point in the history
These are exact matches for CSS colors, so use them instead.
  • Loading branch information
waywardmonkeys committed Dec 4, 2024
1 parent d796c78 commit 1888945
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
42 changes: 21 additions & 21 deletions examples/scenes/src/test_scenes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,28 +138,28 @@ mod impls {
scene.fill(
Fill::NonZero,
Affine::translate((100.0, 100.0)),
Color::from_rgba8(0, 0, 255, 255),
palette::css::BLUE,
None,
&missing_movetos,
);
scene.fill(
Fill::NonZero,
Affine::IDENTITY,
Color::from_rgba8(0, 0, 255, 255),
palette::css::BLUE,
None,
&empty,
);
scene.fill(
Fill::NonZero,
Affine::IDENTITY,
Color::from_rgba8(0, 0, 255, 255),
palette::css::BLUE,
None,
&only_movetos,
);
scene.stroke(
&Stroke::new(8.0),
Affine::translate((100.0, 100.0)),
Color::from_rgba8(0, 255, 255, 255),
palette::css::AQUA,
None,
&missing_movetos,
);
Expand Down Expand Up @@ -564,7 +564,7 @@ mod impls {
scene.fill(
Fill::NonZero,
t,
&Brush::Solid(Color::from_rgba8(128, 128, 128, 255)),
palette::css::GRAY,
None,
&rect,
);
Expand All @@ -586,7 +586,7 @@ mod impls {
scene.fill(
Fill::NonZero,
t,
&Brush::Solid(Color::from_rgba8(128, 128, 128, 255)),
palette::css::GRAY,
None,
&rect,
);
Expand Down Expand Up @@ -686,7 +686,7 @@ mod impls {
scene.fill(
Fill::NonZero,
Affine::IDENTITY,
&Brush::Solid(Color::from_rgba8(128, 128, 128, 255)),
palette::css::GRAY,
None,
&rect,
);
Expand Down Expand Up @@ -734,7 +734,7 @@ mod impls {
scene.stroke(
&Stroke::new(5.0),
Affine::IDENTITY,
&Brush::Solid(Color::from_rgba8(128, 0, 0, 255)),
palette::css::MAROON,
None,
&[MoveTo(center), LineTo(p1)],
);
Expand Down Expand Up @@ -825,7 +825,7 @@ mod impls {
pub(super) fn square(scene: &mut Scene, kind: Kind, transform: Affine, extend: Extend) {
let colors = [
palette::css::RED,
Color::from_rgba8(0, 255, 0, 255),
palette::css::LIME,
palette::css::BLUE,
];
let width = 300f64;
Expand Down Expand Up @@ -1168,7 +1168,7 @@ mod impls {
scene.stroke(
&Stroke::new(2.0),
Affine::IDENTITY,
Color::from_rgba8(0, 0, 255, 255),
palette::css::BLUE,
None,
&path,
);
Expand Down Expand Up @@ -1199,7 +1199,7 @@ mod impls {
scene.fill(
Fill::NonZero,
Affine::IDENTITY,
&Brush::Solid(Color::from_rgba8(0, 255, 0, 255)),
palette::css::LIME,
None,
&rect,
);
Expand All @@ -1213,14 +1213,14 @@ mod impls {
scene.fill(
Fill::NonZero,
Affine::IDENTITY,
Color::from_rgba8(255, 0, 0, 255),
palette::css::RED,
None,
&make_diamond(1024.0, 100.0),
);
scene.fill(
Fill::NonZero,
Affine::IDENTITY,
Color::from_rgba8(0, 255, 0, 0x80),
palette::css::LIME.with_alpha(0.5),
None,
&make_diamond(1024.0, 125.0),
);
Expand All @@ -1233,7 +1233,7 @@ mod impls {
scene.fill(
Fill::NonZero,
Affine::IDENTITY,
Color::from_rgba8(0, 0, 255, 0x80),
palette::css::BLUE.with_alpha(0.5),
None,
&make_diamond(1024.0, 175.0),
);
Expand All @@ -1257,9 +1257,9 @@ mod impls {
scene.fill(Fill::NonZero, transform, &radial, None, &rect);
}
const COLORS: &[Color] = &[
Color::from_rgba8(255, 0, 0, 255),
Color::from_rgba8(0, 255, 0, 255),
Color::from_rgba8(0, 0, 255, 255),
palette::css::RED,
palette::css::LIME,
palette::css::BLUE,
];
scene.push_layer(Mix::Normal, 1.0, transform, &rect);
for (i, c) in COLORS.iter().enumerate() {
Expand Down Expand Up @@ -1548,7 +1548,7 @@ mod impls {
scene.fill(
Fill::NonZero,
Affine::IDENTITY,
Color::from_rgba8(255, 255, 255, 128),
palette::css::WHITE.with_alpha(0.5),
None,
&Rect::new(50.0, 50.0, 500.0, 500.0),
);
Expand Down Expand Up @@ -1608,7 +1608,7 @@ mod impls {
scene.fill(
Fill::NonZero,
Affine::new([scale, 0.0, 0.0, scale, 27.07470703125, 176.40660533027858]),
Color::from_rgba8(0, 0, 255, 255),
palette::css::BLUE,
None,
&large_background_rect,
);
Expand All @@ -1622,7 +1622,7 @@ mod impls {
29.027636718750003,
182.9755506427786,
]),
Color::from_rgba8(0, 255, 0, 255),
palette::css::LIME,
None,
&inside_clip_rect,
);
Expand All @@ -1636,7 +1636,7 @@ mod impls {
29.027636718750003,
scale * 559.3583631427786,
]),
Color::from_rgba8(255, 0, 0, 255),
palette::css::RED,
None,
&outside_clip_rect,
);
Expand Down
4 changes: 2 additions & 2 deletions examples/with_winit/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Snapshot {
scene.fill(
Fill::NonZero,
offset,
&Brush::Solid(Color::from_rgba8(0, 0, 0, 200)),
palette::css::BLACK.with_alpha(0.75),
None,
&Rect::new(0., 0., width, height),
);
Expand Down Expand Up @@ -310,7 +310,7 @@ pub fn draw_gpu_profiling(
scene.fill(
Fill::NonZero,
offset,
&Brush::Solid(Color::from_rgba8(0, 0, 0, 200)),
palette::css::BLACK.with_alpha(0.75),
None,
&Rect::new(0., 0., width, height),
);
Expand Down

0 comments on commit 1888945

Please sign in to comment.