Closed Bug 1682439 Opened 5 years ago Closed 4 months ago

Implement CSS contrast-color() function

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
146 Branch
Tracking Status
relnote-firefox --- 146+
firefox146 --- fixed

People

(Reporter: 709922234, Assigned: jfkthame)

References

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

Details

(Keywords: dev-doc-complete, Whiteboard: [platform-feature], [wptsync upstream])

User Story

web-feature: contrast-color

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:85.0) Gecko/20100101 Firefox/85.0

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
Depends on: 1778445

It was resolved today to rename this function to contrast-color(). So renaming this bug as well.
(Also, the function got postponed to level 6 of the specification, though there is no draft yet so keeping it at level 5 for now.)

Sebastian

Summary: Implement CSS color-contrast() function → Implement CSS contrast-color() function

(In reply to Sebastian Zartner [:sebo] from comment #3)

(Also, the function got postponed to level 6 of the specificaction, though there is no draft yet so keeping it at level 5 for now.)

There is a draft of css-color-6: drafts.csswg.org/css-color-6. I guess the CSSWG just forgot to link it in their drafts overview (drafts.csswg.org). You can actually find it at the bottom of the drafts overview under "Other Documents".

Thanks for the hint, Benjamin! I've also asked the CSSWG to add it to the specifications list.

Sebastian

color-contrast() has been renamed to contrast-color() and syntax changed.

https://github.com/w3c/csswg-drafts/issues/7557
https://drafts.csswg.org/css-color-6/#resolving-contrast

(In reply to Woody Li from comment #6)

color-contrast() has been renamed to contrast-color()

Yes, I mentioned that earlier.

and syntax changed.

And the syntax discussion is still not finished, see https://github.com/w3c/csswg-drafts/issues/7937.

Sebastian

No longer blocks: css-color-5
User Story: (updated)
Whiteboard: [platform-feature]

This implements the contrast-color() function from CSS Color 5
(https://drafts.csswg.org/css-color-5/#contrast-color).

The extended version proposed in CSS Color 6 is not sufficiently well spec'd
to consider implementing at this time.

Assignee: nobody → jfkthame
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Making this block CSS Color 5 again instead of level 6. Once implemented, this needs to be documented. So adding the dev-doc-needed flag. It should also be mentioned in the dev and general release notes.

Release Note Request (optional, but appreciated)
[Why is this notable]: New CSS function for automatically choosing a contrasting color.
[Affects Firefox for Android]: yes
[Suggested wording]: Firefox now supports the contrast-color() CSS function that takes a color value and returns a contrasting color. Note that the specification currently restricts the contrasting color to black or white. This limitation is expected to be removed in the future.
[Links (documentation, blog post, etc)]:
https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/contrast-color
https://drafts.csswg.org/css-color-5/#contrast-color

Sebastian

Pushed by jkew@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/f4fa1425b081 https://hg.mozilla.org/integration/autoland/rev/0c13bf616ac7 Implement CSS contrast-color() function. r=firefox-style-system-reviewers,emilio,tlouw https://github.com/mozilla-firefox/firefox/commit/69695ad2db5c https://hg.mozilla.org/integration/autoland/rev/34056693c143 Add a basic WPT reftest for results of the contrast-color() function. r=firefox-style-system-reviewers,emilio
Pushed by sstanca@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/ab91e25575a5 https://hg.mozilla.org/integration/autoland/rev/ab41c4c5cac8 Revert "Bug 1682439 - Add a basic WPT reftest for results of the contrast-color() function. r=firefox-style-system-reviewers,emilio" for causing mochitests failures in test_bug877690.html.
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/55713 for changes under testing/web-platform/tests
Whiteboard: [platform-feature] → [platform-feature], [wptsync upstream]

Reverted this because it was causing mochitests failures in test_bug877690.html.

Flags: needinfo?(jfkthame)

Yeah, I saw this -- we just need to update that test to include the new function name.

Flags: needinfo?(jfkthame)
Pushed by jkew@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/1975a2d7f60a https://hg.mozilla.org/integration/autoland/rev/ee8f95160b26 Implement CSS contrast-color() function. r=firefox-style-system-reviewers,emilio,tlouw https://github.com/mozilla-firefox/firefox/commit/650bf2228217 https://hg.mozilla.org/integration/autoland/rev/82b99fe4af59 Add a basic WPT reftest for results of the contrast-color() function. r=firefox-style-system-reviewers,emilio
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 146 Branch
Upstream PR merged by moz-wptsync-bot
QA Whiteboard: [qa-triage-done-c147/b146]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: