Skip to content

[css-color-5] color-mix() algorithm requires division by zero #14013

@weinig

Description

@weinig

For the case of color-mix(in srgb, red 0%, blue 0%, green 100%), the color-mix() result calculation requires division by zero.

The issue happens in the first iteration of step 4.2.2 calculating (b’s percentage) / combined percentage). In the first iteration, a and b will be [red 0%] and [blue 0%], with a combined percentage of 0%.

My proposal would be to change the text of step 4.2.2, replacing:

"...with a progress percentage equal to (b’s percentage) / combined percentage)."

with

"with a progress percentage equal to (b’s percentage) / combined percentage) if combined percentage is greater than 0, and 0.5 otherwise."

(or something to that effect).

cc @svgeesus

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions