Skip to content

Safari ignores alpha channel in colors in ::marker, which makes styling them with Tailwind impossible #8610

@foca

Description

@foca

What version of Tailwind CSS are you using?

v3.1.2

What build tool (or framework if it abstracts the build tool) are you using?

`postcss`
module.exports = {
  plugins: {
    "postcss-import": {},
    "tailwindcss": {},
    "autoprefixer": {},
  }
}

What version of Node.js are you using?

v12.22.9

What browser are you using?

Safari 15.5 on macOS 12.4

Reproduction URL

https://play.tailwindcss.com/iea3Szbz1t

Describe your issue

On Safari, all of the following examples work correctly:

::marker {
  color: red;
}
::marker {
  color: #f00;
}
::marker {
  color: rgb(255 0 0);
}

But these are completely ignored:

::marker {
  color: rgba(255 0 0 50);
}
::marker {
  color: rgb(255 0 0 / 50);
}

I discovered this while playing with arbitrary variants, trying to lighten the ordinals in an ordered list. When that didn't work, I thought, "that's fine, I can just use an arbitrary value!" but turns out that [&::marker]:text-[#ff0000] gets translated to

.\[\&\:\:marker\]\:text-\[\#ff0000\]::marker {
  --tw-text-opacity: 1;
  color: rgb(255 0 0 / var(--tw-text-opacity));
}

Which makes it impossible to use Tailwind to style marker colors.

I realize this is more of a Safari bug than a Tailwind bug, but I'm curious as to why you're translating a hardcoded [red] into an RGBA value, and whether that's something that could be addressed to allow styling list markers with Tailwind 🤔

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions