Chapter 02 Foundations
Theme builder
Your colour and your corners first, then shadow, motion and a stronger focus ring. Every theme this page makes keeps text at 7:1 in light and dark.
The rules
- No colour is set by hand. You give a brand colour; the builder works out the rest. With your own colour, the greys turn neutral, so they never clash with it. Why: A hand-picked colour skips the measuring, and that is where unreadable text comes from. Even Okaapi's own blue (5.4:1) and red (4.1:1) failed, so product UI uses darker shades of both.
- Every colour is measured. 7:1 for text, 3:1 for edges, at rest, on hover and when pressed, in light and dark. Why: A contrast ratio compares text with what is behind it: 1:1 is invisible, 21:1 is black on white. 7:1 is WCAG's highest level, so text still reads with low vision, on an old screen or on a phone in the sun. A test fails the build if one pair falls short.
- Each colour has one meaning. Red is for errors and deleting, green for done, warning for "needs a look". Why: People learn a colour once. If danger were purple in one app, the habit would break in every app built on Okaapi.
- Controls are 44px; the focus ring can only grow. The ring is at least 3px wide with a 2px gap. Why: 44px is a target a finger hits the first time, and every layout is tested at that size. A thinner ring is hard to find for people who use the keyboard, so it can grow but never shrink.
- Type and spacing stay Okaapi's.Why: Every component is tested with these fonts, sizes and gaps, in Arabic and English, with text at 200% and at 320px wide. Change them and that testing no longer holds.
- The rest is yours: corners, shadow and motion.Why: They change the look, not whether people can read, touch or find their place. People who ask their system for less motion get none, whatever is set here.
- We support what this page makes.Why: Any
--ui-*variable can be overridden, it is CSS. Only this page's output is measured, so only it carries the guarantee.
Build your theme
As most people see it.
Contrast
Text is easy to read everywhere in your theme: 53 of 53 checks pass, in light and dark. It is the same list the kit's test runs on every push, so a theme that passes here passes there.
Show every check, with its contrast ratio
| Pair | Needs | Light | Dark |
|---|---|---|---|
| text on bg | 7:1 | 17.7:1 Pass | 17.7:1 Pass |
| text on surface | 7:1 | 18.9:1 Pass | 15.9:1 Pass |
| text-muted on surface | 7:1 | 8.4:1 Pass | 10.9:1 Pass |
| on-primary on primary | 7:1 | 7.6:1 Pass | 9.1:1 Pass |
| on-secondary on secondary | 7:1 | 15.3:1 Pass | 13.2:1 Pass |
| on-danger on danger | 7:1 | 8.2:1 Pass | 9.5:1 Pass |
| on-highlight on highlight | 7:1 | 15.1:1 Pass | 9.7:1 Pass |
| danger on surface | 7:1 | 8.2:1 Pass | 8.6:1 Pass |
| danger on danger-soft | 7:1 | 7.3:1 Pass | 8.2:1 Pass |
| on-success on success | 7:1 | 9.1:1 Pass | 13.5:1 Pass |
| success on success-soft | 7:1 | 8.0:1 Pass | 10.5:1 Pass |
| on-warning on warning | 7:1 | 8.6:1 Pass | 13.1:1 Pass |
| warning on warning-soft | 7:1 | 7.7:1 Pass | 10.2:1 Pass |
| text-muted on bg | 7:1 | 7.8:1 Pass | 12.1:1 Pass |
| Links: primary on the page | 7:1 | 7.1:1 Pass | 9.1:1 Pass |
| text on success-soft | 7:1 | 16.7:1 Pass | 13.7:1 Pass |
| text on warning-soft | 7:1 | 16.9:1 Pass | 13.8:1 Pass |
| text on danger-soft | 7:1 | 16.8:1 Pass | 15.2:1 Pass |
| border on surface | 3:1 | 6.1:1 Pass | 7.0:1 Pass |
| border on bg | 3:1 | 5.7:1 Pass | 7.8:1 Pass |
| Focus ring on the page | 3:1 | 7.1:1 Pass | 9.1:1 Pass |
| Focus ring on a surface | 3:1 | 7.6:1 Pass | 8.2:1 Pass |
| primary on highlight | 3:1 | 6.0:1 Pass | 5.0:1 Pass |
| primary on secondary | 3:1 | 6.1:1 Pass | 6.8:1 Pass |
| chart-1 on surface | 3:1 | 5.4:1 Pass | 5.9:1 Pass |
| chart-2 on surface | 3:1 | 4.3:1 Pass | 5.7:1 Pass |
| chart-3 on surface | 3:1 | 5.2:1 Pass | 5.2:1 Pass |
| chart-4 on surface | 3:1 | 4.1:1 Pass | 5.4:1 Pass |
| chart-muted on surface | 3:1 | 3.9:1 Pass | 4.9:1 Pass |
| chart-on-heat-1 on chart-heat-1 | 7:1 | 16.1:1 Pass | 11.9:1 Pass |
| chart-on-heat-2 on chart-heat-2 | 7:1 | 12.0:1 Pass | 8.0:1 Pass |
| chart-on-heat-3 on chart-heat-3 | 7:1 | 8.2:1 Pass | 8.2:1 Pass |
| chart-on-heat-4 on chart-heat-4 | 7:1 | 7.1:1 Pass | 11.5:1 Pass |
| chart-on-heat-5 on chart-heat-5 | 7:1 | 12.4:1 Pass | 15.7:1 Pass |
| Primary button, hover | 7:1 | 8.7:1 Pass | 9.9:1 Pass |
| Primary button, pressed | 7:1 | 10.6:1 Pass | 11.1:1 Pass |
| Danger button, hover | 7:1 | 9.3:1 Pass | 10.2:1 Pass |
| Danger button, pressed | 7:1 | 11.2:1 Pass | 11.4:1 Pass |
| Success button, hover | 7:1 | 10.2:1 Pass | 13.9:1 Pass |
| Success button, pressed | 7:1 | 12.0:1 Pass | 14.6:1 Pass |
| Warning button, hover | 7:1 | 9.7:1 Pass | 13.5:1 Pass |
| Warning button, pressed | 7:1 | 11.5:1 Pass | 14.3:1 Pass |
| Secondary button, hover | 7:1 | 12.5:1 Pass | 13.9:1 Pass |
| Secondary button, pressed | 7:1 | 9.0:1 Pass | 15.2:1 Pass |
| Soft button, hover | 7:1 | 12.3:1 Pass | 10.7:1 Pass |
| Soft button, pressed | 7:1 | 8.8:1 Pass | 12.3:1 Pass |
| Plain, on the page button, hover | 7:1 | 14.4:1 Pass | 13.9:1 Pass |
| Plain, on the page button, pressed | 7:1 | 10.2:1 Pass | 8.4:1 Pass |
| Plain, on a surface button, hover | 7:1 | 15.3:1 Pass | 12.0:1 Pass |
| Plain, on a surface button, pressed | 7:1 | 10.9:1 Pass | 7.3:1 Pass |
| Ghost button, hover | 7:1 | 15.3:1 Pass | 13.2:1 Pass |
| Ghost button, pressed | 7:1 | 10.6:1 Pass | 14.5:1 Pass |
| Outline button, pressed | 7:1 | 10.6:1 Pass | 11.1:1 Pass |
theme.css
Load it after the kit's stylesheet. It holds only what you changed, so a new Okaapi release still reaches the rest.
Nothing changed yet. The kit as it ships needs no theme file.