Skip to content

[css-color-hdr] Update dynamic-range-limit-mix to reflect #10271. #11086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 43 additions & 4 deletions css-color-hdr/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,12 @@ The 'dynamic-range-limit' property {#the-dynamic-range-limit-property}

<pre class='propdef'>
Name: dynamic-range-limit
Value: standard | high | constrained-high
Value: standard | high | constrained-high | ''dynamic-range-limit-mix()''
Initial: high
Applies to: all elements
Inherited: no
Percentages: n/a
Computed value: specified value
Computed value: see <a href="#computing-dynamic-range-limit">Computed Value for 'dynamic-range-limit'</a>
Animation type: by ''dynamic-range-limit-mix()''
Canonical order: per grammar
</pre>
Expand Down Expand Up @@ -309,10 +309,49 @@ Mixing Dynamic Range Limits: the ''dynamic-range-limit-mix()'' function {#dynami


<pre class='prod'>
<dfn>dynamic-range-limit-mix()</dfn> = dynamic-range-limit-mix( [ <<ident>> && <<percentage [0,100]>>? ]#{2})
<dfn>dynamic-range-limit-mix()</dfn> = dynamic-range-limit-mix( [ <<ident>> && <<percentage [0,100]>> ]+)
</pre>

Percentages are normalized in the same way as ''color-mix()''.
If the sum of all percentages is 0%, then the function is invalid.

<h3 id="computing-dynamic-range-limit">
Computed Value for 'dynamic-range-limit'
</h3>

If the specified value is ''standard'', ''constrained-high'', or ''high'', then the computed value is the specified value.

If the specified value is ''dynamic-range-limit-mix()'', then the computed value is determined by the following algorithm:

1. Let <var>v1</var>, ..., <var>vN</var> be the computed values for the parameters to be mixed.
2. Let <var>p1</var>, ..., <var>pN</var> be the mixing percentages, normalized to sum to 100%.
3. Define the contributing percentages as:
* Let <var>p1_standard</var>,...,<var>pN_standard</var> be the percentages for ''standard'' in <var>v1</var>,...,<var>vN</var>
* Let <var>p1_constrained_high</var>,...,<var>pN_constrained_high</var> be the percentages for ''constrained-high'' in <var>v1</var>,...,<var>vN</var>
* Let <var>p1_high</var>,...,<var>pN_high</var> be the percentages for ''high'' in <var>v1</var>,...,<var>vN</var>
4. Compute the weighted sums as:
* <var>p_standard</var>=(<var>p1_standard</var>*<var>p1</var>+...+<var>pN_standard</var>*<var>pN</var>)/100.
* <var>p_constrained_high</var>=(<var>p1_constrained_high</var>*<var>p1</var>+...+<var>pN_constrained_high</var>*<var>pN</var>)/100.
* <var>p_high</var>=(<var>p1_high</var>*<var>p1</var>+...+<var>pN_high</var>*<var>pN</var>)/100.
5. If <var>p_standard</var>, <var>p_constrained_high</var>, or <var>p_high</var> equals 100%, then
the computed value is ''standard'', ''constrained-high'', or ''high'', respectively.
6. Otherwise, the computed value is ''dynamic-range-limit-mix()'', with parameters
''standard'', ''constrained-high'', and ''high'', in that order, and percentages
<var>p_standard</var>, <var>p_constrained_high</var>, and <var>p_high</var>,
omitting parameters with a percentage equal to 0%.

<div class="example" id="ex-hdr-limit-mix">
The computed value of
<pre class="lang-css">
dynamic-range-limit-mix(
high 10%,
dynamic-range-limit-mix(standard 25%, constrained-high 75%) 20%,
dynamic-range-limit-mix(constrained-high 10%, high 30%) 20%)
</pre>
is
<pre class="lang-css">
dynamic-range-limit-mix(standard 10%, constrained-high 40%, high 50%)
</pre>
</div>

<h2 id="color-function">
Specifying Predefined and Custom Color Spaces: the ''color()'' Function
Expand Down