public final class VibrancyMatrix
- Object
- VibrancyMatrix
The colour matrix iOS uses to draw VIBRANT content over glass – tab bar icons and labels, among others.
A vibrant glyph is not painted in its tint. Each of its pixels is a colour
transform of whatever lies BEHIND it: out = clamp(M * backdrop + offset),
with the glyph’s coverage deciding how much of out replaces the backdrop
(Graphics.colorMatrixRegion paints exactly that). The tint only chooses the
matrix. That is why the selected tab of an iOS tab bar is a different blue
over every backdrop, and far more vivid than the plain accent in dark mode.
MEASURED, NOT APPROXIMATED BY EYE. The matrices were read from UIKit itself: the
motion probe (scripts/fidelity-app/ios-native-ref/motion-probe) sets a tab
bar’s tint to thousands of colours on the iOS 27 simulator and reads back the
vibrantColorMatrix filter UIKit installs on the item layers. They follow closed
forms exactly, with t the tint, d = 1 - t and e = 0.5 * min(t) / max(t):
- dark:
M = e * I + (0.5 - e) * 1 * t^T / |t|^2,offset = t - light:
M = e * I + 0.3 * (0.5 - e) * (1 + t) * d^T / |d|^2,offset = alpha * (1 + t) - 1 + e * twithalpha = 1 - e - 0.3 * (0.5 - e) * sum(d) / |d|^2, which is what makes a white backdrop come out as exactlyt - grey tints
g(both appearances):M = 5/16 * I / q,offset = (19/16 * g - 1/4) / qwithq = 1 + 0.05 * g * (1 - g)
Against every matrix the probe logged (7024 distinct light tints, 1354 dark, and
the grey levels of both) the worst entry is off by 5e-6, the precision of the
log itself.
tabmotion.py vibrancy re-checks them against new captures.
Methods
public static float[] forTint(int rgb, boolean dark) | The vibrancy matrix for content tinted rgb, as 12 floats: three rows (red, green, blue) of [r, g, b, offset], in 0..1 units, the layout Graphics.colorMatrixRegion takes. |
public static int apply(float[] m, int rgb) | Applies a 12-float colour matrix to one 0xRRGGBB colour (clamped), the per-pixel operation of Graphics.colorMatrixRegion at full coverage. |
Inherited methods
Method details
forTint
public static float[] forTint(int rgb, boolean dark)rgb, as 12 floats: three rows
(red, green, blue) of [r, g, b, offset], in 0..1 units, the layout
Graphics.colorMatrixRegion takes.Parameters
rgbint- the tint, 0xRRGGBB
darkboolean- true for the dark appearance
Returns
apply
public static int apply(float[] m, int rgb)Parameters
mfloat[]- the matrix, as returned by
#forTint(int, boolean) rgbint- the colour, 0xRRGGBB