01

How a screen colour is stored

A colour on a display is three numbers: how much red, green and blue light to emit, each on a scale from 0 to 255. That is 8 bits per channel and 24 bits in total, giving 16 777 216 possible colours.

Hex notation packs those three numbers into six characters. Each channel becomes two hex digits, so #FF8800 means red = FF (255), green = 88 (136) and blue = 00 (0) — a strong orange.

Hex and RGB#RRGGBB → rgb(R, G, B)
FF = 255, 88 = 136, 00 = 0
#F80 is shorthand for #FF8800

The three-digit shorthand works by doubling each digit: F80 expands to FF8800. It can only express 4096 colours, which is why it has largely fallen out of use outside of quick CSS.

02

Inverting a colour

Inversion replaces each channel with its complement: R′ = 255 − R, and the same for green and blue. It is a bitwise NOT on each byte, and it is its own inverse — invert twice and you are back where you started.

#FF8800 inverted
ChannelOriginalHexInvertedHex
Red255FF000
Green1368811977
Blue000255FF

The result is #0077FF, a vivid blue. That pairing is not arbitrary: orange and blue sit opposite each other on the colour wheel, and inverting RGB approximately inverts hue as well as lightness.

The luminance always sums to 255. Because each channel is replaced by 255 minus itself, the weighted luminance of the inverted colour is exactly 255 minus the original. The tool reports both so you can see the sum.

03

Luminance is not brightness perception

The tool computes luminance as 0.2126R + 0.7152G + 0.0722B, the standard weighted sum that reflects how much each channel contributes to perceived brightness. Green dominates, blue barely registers.

For #FF8800 that gives 151.5 out of 255, and the inverted colour gives 103.5. The two sum to 255, but the perceived brightnesses do not feel symmetric — a mid-orange and a mid-blue of equal computed luminance look quite different, because the eye's response is nonlinear.

This is why naive RGB inversion produces unpleasantly saturated results. A photographic negative uses a different transform, and dark-mode design uses lightness remapping rather than channel inversion. RGB inversion is exact arithmetic; perceptual inversion is a design problem.

04

Contrast and accessibility

Inverting a foreground colour does not automatically produce an accessible pairing with its background. WCAG contrast is computed from relative luminance after gamma correction, not from the raw weighted sum, and the required ratio is 4.5:1 for body text and 3:1 for large text.

Common inversion results
OriginalInvertedEffect
#FFFFFF white#000000 blackMaximum contrast preserved
#000000 black#FFFFFF whiteMaximum contrast preserved
#FF0000 red#00FFFF cyanHue rotated, saturation preserved
#808080 grey#7F7F7F greyAlmost unchanged — mid-grey is near its own inverse
#14181E ink#EBE7E1 paperDark text becomes light text

The grey row is the interesting one. Mid-grey sits almost exactly at the midpoint of the scale, so inverting it barely changes it. Any colour near 127 or 128 will survive inversion looking much the same.

05

Where colour inversion is used

  • Dark mode previews — a quick inversion shows roughly what a light interface looks like inverted, though the result always needs hand-tuning.
  • Highlighting — selecting text inverts the foreground and background together, which guarantees visibility without choosing a highlight colour.
  • Image processing — inverting a scanned negative, or producing a negative for printing.
  • Debugging — flipping a colour is the fastest way to check whether a channel has been swapped.
  • Game and UI effects — a damage flash or a stun effect is often implemented as a screen-space colour inversion.

In all of these the operation is the same three subtractions. What varies is whether the result is used directly or as a starting point for further adjustment.

?

Frequently asked questions

What is the inverse of #FF8800?

#0077FF. Each channel is subtracted from 255: 255−255 = 0, 255−136 = 119, 255−0 = 255, giving 00, 77, FF.

Does inverting a colour give its complement on the colour wheel?

Approximately. For saturated colours the result is close to the opposite hue, but for muted or desaturated colours the relationship is looser because inversion works on channels rather than on hue.

Why does grey barely change when inverted?

Because mid-grey is close to 128, and 255 − 128 = 127. Any colour near the midpoint of the scale inverts to something very similar to itself.

Is this the same as a photographic negative?

Not exactly. A film negative inverts through the dye layers, which introduces cross-channel effects. For screen colours, the arithmetic inversion here is the version you want.

Can I invert only one channel?

Not with this tool, which inverts all three together. Inverting a single channel is a useful effect but produces a hue shift rather than a true inverse.

How do I type a hex colour?

Six hex digits with or without the leading #, or three digits for the shorthand form. The tool accepts either case, so ff8800 and FF8800 are treated identically.