Theme Needs v5
Pass a theme to match AutoProctor's candidate dialogs and proctoring report to your brand colours.
Setting a Theme
Pass theme to the constructor, alongside your credentials, not to .setup() with your proctoring options. The theme colours the report too, and a page that only shows a report calls .showReport() without ever calling .setup():
const apInst = new AutoProctor({
clientId: 'your-client-id',
testAttemptId: 'unique-test-attempt-id',
hashedTestAttemptId: 'a1b2c3d4e5...',
theme: {
primary: '#0f766e',
danger: '#b91c1c',
surface: '#ffffff',
}
})
Every key is optional. Hover states, light backgrounds, focus rings and secondary text shades are derived from the colours you pass. Keys you leave out keep AutoProctor's default colour, with two exceptions: if you pass primary without secondary or tertiary, those two are derived from your primary too, and info follows primary.
Keys
| Key | Used for |
|---|---|
primary | Brand colour: buttons, links, spinners, focus ring, info accents. |
secondary | Active report tab and secondary accents. Derived from primary if not set. |
tertiary | Muted pills and neutral accents. Derived from primary if not set. |
danger | Destructive actions and error text. |
success | Success headers, result rows and the recording indicator. |
warning | Warning headers and callouts. |
info | Info highlights. Defaults to primary. |
text | Base text colour. Muted and faint text derive from it. |
surface | Dialog and card background. Hover and pressed fills derive from it. |
border | Control borders. Dividers derive from it. |
Each value must be a colour string in one of these formats: #rgb, #rrggbb, rgb(r, g, b) or rgba(r, g, b, a). Named colours (red), hsl() and CSS variables are not accepted. The alpha of rgba() is ignored.
Validation
- An unknown key, a
themethat isn't an object, or a value that isn't a non-empty string makes the constructor throw. - A colour in the wrong format (for example
'teal') doesn't throw in the defaultproductionenvironment. That key is dropped with a console warning and its default colour is used, so a typo in a colour can never stop a candidate from taking a test. Otherenvironmentvalues throw instead.
While testing, watch the browser console for [AutoProctor] theme... warnings.
Scope
- The theme is applied to the whole page while the instance is alive (it sets CSS custom properties on
<html>), and removed by.destroy(). - It covers the candidate-facing dialogs and the report from
.showReport(). The results table from.showResults()is not themed. - On the auxiliary device, pass the same
themeon the phone page. - Your own stylesheet can still override any
--ap-*custom property with!important.