Skip to content

Commit

Permalink
feat: add bg opacity plugin support
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed May 22, 2023
1 parent 64d5f32 commit ab69a21
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions crates/tailwind-parse/src/eval/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,9 @@ pub fn snap<'a>(
}]))
}


lookup_plugin!(bg_opacity, opacity, "--tw-bg-opacity");

pub fn bg<'a>(
val: &SubjectValue,
theme: &'a TailwindTheme,
Expand Down
4 changes: 3 additions & 1 deletion crates/tailwind-parse/src/literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ impl<'a> Literal<'a> {
alpha: &Option<Value>,
) -> Result<ObjectLit, LiteralConversionError<'a>> {
use crate::Auto;
use crate::Bg;
use crate::Gap;
use crate::Inset;
use crate::List;
Expand Down Expand Up @@ -196,7 +197,8 @@ impl<'a> Literal<'a> {
Ring(Some(Ring::Opacity)) => RequiredArbitrary(plugin::ring_opacity),
Ring(Some(Ring::Inset)) => Singular(plugin::ring_inset),
Sr => Required(plugin::sr),
Bg => RequiredArbitraryTransparency(plugin::bg),
Bg(None) => RequiredArbitraryTransparency(plugin::bg),
Bg(Some(Bg::Opacity)) => Required(plugin::bg_opacity),
H => RequiredArbitrary(plugin::h),
W => RequiredArbitrary(plugin::w),
TransformOrigin => Required(plugin::transform_origin),
Expand Down
7 changes: 6 additions & 1 deletion crates/tailwind-parse/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mod plugin {
Text(Option<Text>),
Accent,
Caret,
Bg,
Bg(Option<Bg>),
Font,
Fill,
Shadow,
Expand Down Expand Up @@ -140,6 +140,11 @@ mod plugin {
Not(Not),
}

#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum Bg {
Opacity,
}

#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum Text {
Opacity,
Expand Down

0 comments on commit ab69a21

Please sign in to comment.