Closed Bug 1815186 Opened 3 years ago Closed 2 years ago

Expose function that can convert color spaces to chrome

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
125 Branch
Tracking Status
firefox125 --- fixed

People

(Reporter: tlouw, Assigned: tlouw)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

Attachments

(1 external file)

This would allow things like devtools to convert between color formats/spaces with the calculations done on the platform side.

A use case is to implement InspectorUtils.colorTo(color, colorSpace) for use in the color picker to convert colors.

Depends on: 1812545
Assignee: nobody → tlouw

This will allow calling InspectorUtils.ColorTo("red", "lab") and
receive {color: "lab(54.3 80.8 69.9)", adjusted: false}.

Adjusted is set to true if the color was adjusted to fit into the sRGB
color space.

We need the computed color values in the extended AbsoluteColor format as well as support for detecting/mapping gamut.

Depends on: 1817641, 1626624
Blocks: css-color-4
Attachment #9317905 - Attachment description: WIP: Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,#layout-reviewers → Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,#layout-reviewers
Attachment #9317905 - Attachment description: Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,#layout-reviewers → WIP: Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,#layout-reviewers
Attachment #9317905 - Attachment description: WIP: Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,#layout-reviewers → Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,#layout-reviewers

Adjusted is set to true if the color was adjusted to fit into the sRGB color space.

Is that for HSL/HWB? If so, that requirement is under discussion and likely to be dropped.

If it is for gamut mapping to screens, not all screens are sRGB - is there a different flag if it has been gamut mapped to, say, a P3 screen?

Attachment #9317905 - Attachment description: Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,#layout-reviewers → WIP: Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,#layout-reviewers
Attachment #9317905 - Attachment description: WIP: Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,#layout-reviewers → Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,#layout-reviewers
Pushed by tlouw@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ab9f3266184b Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,layout-reviewers,supply-chain-reviewers

Backed out for causing failures at test_color_to.html.

Backout link

Push with failures

Failure log

Flags: needinfo?(tlouw)

Seems to be a strange Android only float serialization issue, will fix test.

Flags: needinfo?(tlouw)
Depends on: 1862928
Attachment #9317905 - Attachment description: Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,#layout-reviewers → WIP: Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,#layout-reviewers
Attachment #9317905 - Attachment description: WIP: Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,#layout-reviewers → Bug 1815186 - Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,#layout-reviewers
Pushed by tlouw@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/28454778bc26 Add ColorTo to InspectorUtils to convert color to other color spaces. r=emilio,layout-reviewers,supply-chain-reviewers
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 125 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: