Closed Bug 1857006 Opened 1 year ago Closed 2 months ago

Consider fading the unused value from light-dark() colors.

Categories

(DevTools :: Inspector: Rules, enhancement, P3)

enhancement

Tracking

(firefox131 fixed)

RESOLVED FIXED
131 Branch
Tracking Status
firefox131 --- fixed

People

(Reporter: emilio, Assigned: nchevobbe)

References

(Blocks 2 open bugs)

Details

Attachments

(3 files, 2 obsolete files)

When you use the light-dark() color, it's only going to compute to one of the two colors. Maybe DevTools could highlight that by fading the color that isn't computed.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #0)

When you use the light-dark() color, it's only going to compute to one of the two colors. Maybe DevTools could highlight that by fading the color that isn't computed.

I didn't look into the spec about this, but do we have an easy way to know the value being used?

Flags: needinfo?(emilio)

We could expose a function trivially to get the used color scheme. It depends on a number of factors so it might not be straight-forward to compute otherwise:

  • Preferred user color scheme.
  • <meta name=color-scheme> if present.
  • color-scheme property value if present.
Flags: needinfo?(emilio)
Priority: -- → P3

(In reply to Emilio Cobos Álvarez (:emilio) from comment #2)

We could expose a function trivially to get the used color scheme. It depends on a number of factors so it might not be straight-forward to compute otherwise:

  • Preferred user color scheme.
  • <meta name=color-scheme> if present.
  • color-scheme property value if present.

I filed Bug 1899103 to add such function

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

Comment on attachment 9404298 [details]
Bug 1857006 - [devtools] Fix JsDoc for OutputParser#mergeOptions. r=#devtools-reviewers.

Revision D211844 was moved to bug 1899952. Setting attachment 9404298 [details] to obsolete.

Attachment #9404298 - Attachment is obsolete: true

This patch adds a new isDarkColorScheme option to the OutputParser.
When passed, this will parse light-dark function to add an "unmatched" CSS
class to the param that isn't used: the first one when isDarkColorsScheme is
false, the second one when isDarkColorScheme is true.
Test cases are added in browser_outputparser.js to cover this.

Attachment #9404299 - Attachment description: WIP: Bug 1857006 - [devtools] Strike through unused light-dark parameter. r=#devtools-reviewers. → Bug 1857006 - [devtools] Strike through unused light-dark parameter in Rules view. r=#devtools-reviewers.

Comment on attachment 9416318 [details]
Bug 1857006 - [devtools] Rename OutputParser unmatchedVariableClass option into unmatchedClass so it can be used for light-dark(). r=#devtools-reviewers.

Revision D217832 was moved to bug 1910569. Setting attachment 9416318 [details] to obsolete.

Attachment #9416318 - Attachment is obsolete: true

This patch introduce a new #stack property on the parser, which hold the parenthesis
stack so we can handle nested functions.
We switch the existing colorFunctions array to this new stack as it's doing
something similar, but a bit more generic.

When there's at least an entry in the stack, we want to put the parsed parts,
text or nodes, into the parts stack entry property so it can be used later
when we handle the function being closed.

This parts get put into the "parent" stack entry, or into the main #parsed array
when the stack becomes empty.

We could go further, migrating parseMatchingParens/parseVariable to use the
stack and the onCloseParenthesis method. This might be done as part of Bug 1630950,
where we want to handle nested css variables.

Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/32b4d9169b24 [devtools] Refactor OutputParser for parsing (color) functions. r=devtools-reviewers,bomsy. https://hg.mozilla.org/integration/autoland/rev/86a6fb48af62 [devtools] Parse light-dark() function in output-parser. r=devtools-reviewers,ochameau. https://hg.mozilla.org/integration/autoland/rev/0f65f19f14c4 [devtools] Strike through unused light-dark parameter in Rules view. r=devtools-reviewers,ochameau.
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 131 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: