mix-blend-mode:difference Inversion Note

Opaque same-space difference blend |Cb−Cs|; white source gives inversion, unlike universal invert of arbitrary source/alpha. Explicit supplied computed/layout context only; not a browser cascade/layout engine or cross-browser guarantee.

Description

Difference blending compares channels in an established blending space.

Difference blending compares channels in an established blending space.1

Opaque channel arithmetic does not include alpha compositing or color-space conversion. Use mix-blend-mode:difference Inversion Note to evaluate the supplied inputs under the specific model below.

When to use mix-blend-mode:difference Inversion Note

Use mix-blend-mode:difference Inversion Note to evaluate the supplied inputs under the specific model below. Define the supplied layout, token or rendering scenario and establish the relevant units and browser context independently.

How to use mix-blend-mode:difference Inversion Note and understand its results

  1. Define the supplied layout, token or rendering scenario and establish the relevant units and browser context independently.
  2. Enter Backdrop encoded channels, Source encoded channels using the field table and validation rules below, then run the tool.
  3. Read Difference encoded channels and interpret units, signs, ordering and placeholders as explained below.
  4. If the tool reports an input error, correct that field and rerun. A successful false result, empty match list or unknown-evidence placeholder has the specific meaning described here; check the limitations before applying the result.
Input fieldMeaningValue typeRequirement
backdropEncodedChannelsBackdrop encoded channelsarray of numberRequired; constraints below
sourceEncodedChannelsSource encoded channelsarray of numberRequired; constraints below

Enter exactly three source and backdrop channel values from 0 to 1, already expressed in the chosen blending space. For each opaque channel return the absolute difference. Alpha compositing and color-space conversion are outside the calculation; it does not assume that arbitrary encoded RGB values are already linearized.

resultChannel[i] = abs(backdropChannel[i]−sourceChannel[i])

Field order, units and branch conditions follow the implementation explanation above.

Output fieldMeaningValue type
differenceEncodedChannelsDifference encoded channelsarray of number
json
{
  "input": {
    "backdropEncodedChannels": [
      0.2,
      0.5,
      0.9
    ],
    "sourceEncodedChannels": [
      1,
      1,
      1
    ]
  },
  "output": {
    "differenceEncodedChannels": [
      0.8,
      0.5,
      0.09999999999999998
    ]
  }
}

Limitations and assumptions

Opaque channel arithmetic does not include alpha compositing or color-space conversion. Apply the exact scope and assumptions described above.

All listed fields require explicit values. Unexpected fields, incorrect types, nonfinite numbers and sparse arrays fail validation. Domain-specific bounds, alignments and supported tokens are stated above; extremely large inputs or outputs can also be rejected. These errors differ from successful results such as false, no matches or unknown evidence.

Alternative or Complementary methods

Use Blend Mode Family List Lookup for a related task: Blend modes combine source and backdrop under different channel rules.

Use mask-image Alpha vs Luminance Mode Lookup for a related task: Mask coverage can depend on alpha alone or on luminance multiplied by alpha.

References

  1. mix-blend-mode:difference Inversion Note — tool.io

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies