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

KeyUsed for
primaryBrand colour: buttons, links, spinners, focus ring, info accents.
secondaryActive report tab and secondary accents. Derived from primary if not set.
tertiaryMuted pills and neutral accents. Derived from primary if not set.
dangerDestructive actions and error text.
successSuccess headers, result rows and the recording indicator.
warningWarning headers and callouts.
infoInfo highlights. Defaults to primary.
textBase text colour. Muted and faint text derive from it.
surfaceDialog and card background. Hover and pressed fills derive from it.
borderControl 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 theme that 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 default production environment. 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. Other environment values 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 theme on the phone page.
  • Your own stylesheet can still override any --ap-* custom property with !important.