Skip to content
Okaapiأوكابي
Framework for the code
Theme
Okaapi on GitHub

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

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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

Light mode: darkened a little, so the white text on it is easy to read.

Dark mode: lightened a little, so the dark text on it is easy to read.

See it as people with

As most people see it.

Delivery details

We text you when the order leaves. Delivery times

Shown with its focus ring.

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
PairNeedsLightDark
text on bg7:1 17.7:1 Pass 17.7:1 Pass
text on surface7:1 18.9:1 Pass 15.9:1 Pass
text-muted on surface7:1 8.4:1 Pass 10.9:1 Pass
on-primary on primary7:1 7.6:1 Pass 9.1:1 Pass
on-secondary on secondary7:1 15.3:1 Pass 13.2:1 Pass
on-danger on danger7:1 8.2:1 Pass 9.5:1 Pass
on-highlight on highlight7:1 15.1:1 Pass 9.7:1 Pass
danger on surface7:1 8.2:1 Pass 8.6:1 Pass
danger on danger-soft7:1 7.3:1 Pass 8.2:1 Pass
on-success on success7:1 9.1:1 Pass 13.5:1 Pass
success on success-soft7:1 8.0:1 Pass 10.5:1 Pass
on-warning on warning7:1 8.6:1 Pass 13.1:1 Pass
warning on warning-soft7:1 7.7:1 Pass 10.2:1 Pass
text-muted on bg7:1 7.8:1 Pass 12.1:1 Pass
Links: primary on the page7:1 7.1:1 Pass 9.1:1 Pass
text on success-soft7:1 16.7:1 Pass 13.7:1 Pass
text on warning-soft7:1 16.9:1 Pass 13.8:1 Pass
text on danger-soft7:1 16.8:1 Pass 15.2:1 Pass
border on surface3:1 6.1:1 Pass 7.0:1 Pass
border on bg3:1 5.7:1 Pass 7.8:1 Pass
Focus ring on the page3:1 7.1:1 Pass 9.1:1 Pass
Focus ring on a surface3:1 7.6:1 Pass 8.2:1 Pass
primary on highlight3:1 6.0:1 Pass 5.0:1 Pass
primary on secondary3:1 6.1:1 Pass 6.8:1 Pass
chart-1 on surface3:1 5.4:1 Pass 5.9:1 Pass
chart-2 on surface3:1 4.3:1 Pass 5.7:1 Pass
chart-3 on surface3:1 5.2:1 Pass 5.2:1 Pass
chart-4 on surface3:1 4.1:1 Pass 5.4:1 Pass
chart-muted on surface3:1 3.9:1 Pass 4.9:1 Pass
chart-on-heat-1 on chart-heat-17:1 16.1:1 Pass 11.9:1 Pass
chart-on-heat-2 on chart-heat-27:1 12.0:1 Pass 8.0:1 Pass
chart-on-heat-3 on chart-heat-37:1 8.2:1 Pass 8.2:1 Pass
chart-on-heat-4 on chart-heat-47:1 7.1:1 Pass 11.5:1 Pass
chart-on-heat-5 on chart-heat-57:1 12.4:1 Pass 15.7:1 Pass
Primary button, hover7:1 8.7:1 Pass 9.9:1 Pass
Primary button, pressed7:1 10.6:1 Pass 11.1:1 Pass
Danger button, hover7:1 9.3:1 Pass 10.2:1 Pass
Danger button, pressed7:1 11.2:1 Pass 11.4:1 Pass
Success button, hover7:1 10.2:1 Pass 13.9:1 Pass
Success button, pressed7:1 12.0:1 Pass 14.6:1 Pass
Warning button, hover7:1 9.7:1 Pass 13.5:1 Pass
Warning button, pressed7:1 11.5:1 Pass 14.3:1 Pass
Secondary button, hover7:1 12.5:1 Pass 13.9:1 Pass
Secondary button, pressed7:1 9.0:1 Pass 15.2:1 Pass
Soft button, hover7:1 12.3:1 Pass 10.7:1 Pass
Soft button, pressed7:1 8.8:1 Pass 12.3:1 Pass
Plain, on the page button, hover7:1 14.4:1 Pass 13.9:1 Pass
Plain, on the page button, pressed7:1 10.2:1 Pass 8.4:1 Pass
Plain, on a surface button, hover7:1 15.3:1 Pass 12.0:1 Pass
Plain, on a surface button, pressed7:1 10.9:1 Pass 7.3:1 Pass
Ghost button, hover7:1 15.3:1 Pass 13.2:1 Pass
Ghost button, pressed7:1 10.6:1 Pass 14.5:1 Pass
Outline button, pressed7: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.