Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27874,6 +27874,82 @@ mod tests {
);
}

#[test]
fn test_mix_blend_mode() {
minify_test(
".foo { mix-blend-mode: normal }",
".foo{mix-blend-mode:normal}",
);
minify_test(
".foo { mix-blend-mode: multiply }",
".foo{mix-blend-mode:multiply}",
);
minify_test(
".foo { mix-blend-mode: screen }",
".foo{mix-blend-mode:screen}",
);
minify_test(
".foo { mix-blend-mode: overlay }",
".foo{mix-blend-mode:overlay}",
);
minify_test(
".foo { mix-blend-mode: darken }",
".foo{mix-blend-mode:darken}",
);
minify_test(
".foo { mix-blend-mode: lighten }",
".foo{mix-blend-mode:lighten}",
);
minify_test(
".foo { mix-blend-mode: color-dodge }",
".foo{mix-blend-mode:color-dodge}",
);
minify_test(
".foo { mix-blend-mode: color-burn }",
".foo{mix-blend-mode:color-burn}",
);
minify_test(
".foo { mix-blend-mode: hard-light }",
".foo{mix-blend-mode:hard-light}",
);
minify_test(
".foo { mix-blend-mode: soft-light }",
".foo{mix-blend-mode:soft-light}",
);
minify_test(
".foo { mix-blend-mode: difference }",
".foo{mix-blend-mode:difference}",
);
minify_test(
".foo { mix-blend-mode: exclusion }",
".foo{mix-blend-mode:exclusion}",
);
minify_test(
".foo { mix-blend-mode: hue }",
".foo{mix-blend-mode:hue}",
);
minify_test(
".foo { mix-blend-mode: saturation }",
".foo{mix-blend-mode:saturation}",
);
minify_test(
".foo { mix-blend-mode: color }",
".foo{mix-blend-mode:color}",
);
minify_test(
".foo { mix-blend-mode: luminosity }",
".foo{mix-blend-mode:luminosity}",
);
minify_test(
".foo { mix-blend-mode: plus-darker }",
".foo{mix-blend-mode:plus-darker}",
);
minify_test(
".foo { mix-blend-mode: plus-lighter }",
".foo{mix-blend-mode:plus-lighter}",
);
}

#[test]
fn test_viewport() {
minify_test(
Expand Down
43 changes: 43 additions & 0 deletions src/properties/effects.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! CSS properties related to filters and effects.

use crate::macros::enum_property;
use crate::error::{ParserError, PrinterError};
use crate::printer::Printer;
use crate::targets::{Browsers, Targets};
Expand Down Expand Up @@ -410,3 +411,45 @@ impl IsCompatible for FilterList<'_> {
true
}
}

enum_property! {
/// A [`<blend-mode>`](https://www.w3.org/TR/compositing-1/#ltblendmodegt) value.
pub enum BlendMode {
/// The default blend mode; the top layer is drawn over the bottom layer.
Normal,
/// The source and destination are multiplied.
Multiply,
/// Multiplies the complements of the backdrop and source, then complements the result.
Screen,
/// Multiplies or screens, depending on the backdrop color.
Overlay,
/// Selects the darker of the backdrop and source.
Darken,
/// Selects the lighter of the backdrop and source.
Lighten,
/// Brightens the backdrop to reflect the source.
ColorDodge,
/// Darkens the backdrop to reflect the source.
ColorBurn,
/// Multiplies or screens, depending on the source color.
HardLight,
/// Darkens or lightens, depending on the source color.
SoftLight,
/// Subtracts the darker from the lighter.
Difference,
/// Similar to difference, but with lower contrast.
Exclusion,
/// The hue of the source with the saturation and luminosity of the backdrop.
Hue,
/// The saturation of the source with the hue and luminosity of the backdrop.
Saturation,
/// The hue and saturation of the source with the luminosity of the backdrop.
Color,
/// The luminosity of the source with the hue and saturation of the backdrop.
Luminosity,
/// Adds the source to the backdrop, producing a darker result.
PlusDarker,
/// Adds the source to the backdrop, producing a lighter result.
PlusLighter,
}
}
3 changes: 3 additions & 0 deletions src/properties/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1600,6 +1600,9 @@ define_properties! {
"filter": Filter(FilterList<'i>, VendorPrefix) / WebKit,
"backdrop-filter": BackdropFilter(FilterList<'i>, VendorPrefix) / WebKit,

// https://www.w3.org/TR/compositing-1/
"mix-blend-mode": MixBlendMode(BlendMode),

// https://drafts.csswg.org/css2/
"z-index": ZIndex(position::ZIndex),

Expand Down
Loading