Skip to content

Opacity for color-mix is not correctly pre-multiplied. #1195

Closed

Description

@keithamus

@keithamus The current implementation has a bug, see also: https://bugzilla.mozilla.org/show_bug.cgi?id=1901991

The implementation of csskit appears to have the same bug as Firefox; perhaps they can be fixed together.

input

div {
  background-color: color-mix(
    in srgb,
    color(srgb 0.4 0.4 0 / none),
    color(srgb 0.4 0 0.4 / 0.5)
  );
}

.legacy {
  background-color: color-mix(
    in srgb,
    rgb(100 100 0 / none),
    rgb(100 0 100 / 0.5)
  );
}

output

div{background-color:#66006640}.legacy{background-color:#64006440}

expected

div{background-color:#66333380}.legacy{background-color:#64323280}

playground

Originally posted by @yisibl in #871

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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