Color contrast and APCA

Join us in building digital spaces that leave a positive impact on every user, fostering an inclusive design culture

Understanding

Color contrast is important to ServiceNow as it helps users easily distinguish between different elements and navigate the platform more efficiently. It also aids in creating a visually appealing interface that enhances user experience and makes the platform more engaging.

Horizon incorporates APCA (Advanced Perceptual Contrast Algorithm) to enhance accessibility beyond traditional WCAG 2.1 contrast ratios. While APCA uses a different approach than WCAG 2.1's simple contrast method, our implementation ensures Horizon themes provide optimal readability and accessibility for a diverse user base, including those with visual impairments.

Since the initial WCAG criteria on color contrast was written, there have been many advancements in display technology, CSS functionality, as well as vision science. APCA is a modern approach to measuring contrast that aims to better align with human perception.

While APCA is planned for incorporation into the next generation of WCAG standards, it’s current usage patterns aren’t yet defined by the W3C working groups. The following guideline describes ServiceNow’s approach to applying APCA for our modern themes. WCAG 2.1 conformant themes, which use the more traditional approach to calculating contrast, are also available to users on our platform.

Traditional contrast diagram

Traditional contrast WCAG 2.1 at the AA level primarily focuses on two tiers of color contrast: 4.5:1 for text (3:1 for large text) and 3:1 for non-text icons, controls and visual indications of state.

APCA contrast diagram

APCA contrast APCA supports several tiers of contrast depending on not just content type, but the size, purpose and whether or not the background is light or dark.

WCAG 2.1 at the AA level primarily focuses on two tiers of color contrast: 4.5:1 for text (3:1 for large text) and 3:1 for non-text icons, controls and visual indications of state.


Designing

For our APCA based design themes, we break components down into 5 basic categories:

  • Text and icons
  • Form fields
  • Buttons
  • Containers
  • Data visualization

In the following sections, we’ll define the anatomy of these components and lay out the color system we follow in our APCA based themes.


Text and icons

Text and icon anatomy

Text and icons refer to any text or iconography used on a page to provide information. For our themes, we group text into 2 sizes:

  • Large text: any text that is 18 pt or larger, or 14 pt bold (700) or larger.
  • Regular text: any text smaller than large text.
Text and icon anatomy diagram

Text and icon anatomy

  1. Canvas: Background area
  2. Text: Text and icons

Text and icon contrast minimums

When measuring the Lc for text and icons, we compare the color of the canvas to the color of the text, or the icon. In the example above we measure a background of #F5F6F7 against text and an icon of #37444A. This gives us a contrast of Lc88. Our dark background at #10171A compared to text and icon of #FFFFFF gives us a contrast of Lc107.

Below are the contrast requirements for text and icons in the Horizon Design System:

  • Large text vs canvas: Lc45
  • Regular text vs canvas: Lc60
  • Informational icons vs canvas: Lc45
Regular text vs canvas: Lc60 diagram

Regular text vs canvas: Lc60

  1. Canvas
  2. Text
Large text vs canvas: Lc45 diagram

Large text vs canvas: Lc45

  1. Canvas
  2. Text
Icons vs canvas: Lc45 diagram

Icons vs canvas: Lc45

  1. Canvas
  2. Text

Form fields

Form field anatomy

When users interact with forms it is important that they can both identify a form field visually, but also recognize a it’s various states. Form fields include text and textarea inputs, radio buttons, checkboxes and toggles. These inputs can be editable, disabled, readonly, and at times can be in a state of error.

See the following images for the terminology we use when describing contrast minimums for input fields.

Input fields anatomy diagram

Input fields

  1. Field text: User inputted text
  2. Field: Fill color for field
  3. Border: Outline or boundary
  4. Canvas: Background area
Checkboxes anatomy diagram

Checkboxes

  1. Icon: Mark, Dot, or other indicator of the item being checked
  2. Border: Outline or boundary
  3. Field: Fill color inside input
  4. Canvas: Background area
Radio buttons anatomy diagram

Radio buttons

  1. Icon: Mark, Dot, or other indicator of the item being checked
  2. Border: Outline or boundary
  3. Field: Fill color inside input
  4. Canvas: Background area

Form field text minimums

Below we’ll demonstrate the contrast requirements for input fields in the Horizon Design System.

To ensure text inside of inputs are visible across all states, we adhere to the following contrast minimums:

  • Field text vs field: Lc60
  • Disabled text vs field: Lc15
  • Placeholder text vs field: Lc30
  • Readonly text vs field: Lc60
Diagram showing Field text vs Field: Lc60

Field text

  1. Text
  2. Field
Diagram showing Disabled text vs Field: Lc15

Disabled text

  1. Text
  2. Field
Diagram showing Placeholder text vs Field: Lc30

Placeholder text

  1. Text
  2. Field
Diagram showing Readonly text vs Field: Lc60

Readonly text

  1. Text
  2. Field

Form field visibility minimums

To ensure that inputs fields are visible on the page canvas, 1 of the 3 following pairs will meet Lc30:

  • Field vs border
  • Canvas vs border
  • Canvas vs field

If the input field is read-only, the minimum drops to Lc15.

Diagram showing Field vs Border: L30

Field vs border

  1. Field
  2. Border
Diagram showing Canvas vs Border: L30

Canvas vs border

  1. Canvas
  2. Border
Diagram showing Canvas vs Field: L30

Canvas vs field

  1. Canvas
  2. Field

Form state minimums

To ensure that various states of inputs fields are visible, we adhere to the following contrast minimums:

  • Focus ring vs canvas or Focus ring vs field : Lc30
  • Default border vs error border: Lc30
Diagram of Focus ring vs canvas or  Focus ring vs field

Focus ring vs canvas or Focus ring vs field

  1. Field
  2. Focus ring
  3. Canvas
Diagram of Default border vs error border

Default border vs error border

  1. Default border
  2. Error border

Buttons

Button anatomy

Buttons in Horizon come in several varieties including text buttons, icon buttons, stateful buttons, and bare buttons. Buttons are also available in Primary, Secondary, and Tertiary visual varieties.

For determining contrast, we’ll consider four parts to a button:

  • Button face
  • Button contents (text or icons)
  • Button border
  • Canvas

Button content minimums

Button contents, which include text and buttons, follow the same minimums for any regular text (Lc60) and information icons (Lc45) when compared to the button face.

If the button is disabled, this drops to Lc15.

Diagram of Button text vs Button face

Button text vs Button face

  1. Text
  2. Face
Diagram of Button icon vs Button face

Button icon vs Button face

  1. Icon
  2. Face
Diagram of Button text vs Button face

Button text vs Button face

  1. Text
  2. Face

Button visibility minimums

To ensure that primary buttons are visible on the page canvas, one of the three following pairs will meet Lc30:

  • Face vs border
  • Canvas vs border
  • Face vs canvas

For secondary and tertiary buttons, the minimum drops to Lc15. Bare buttons do not have any requirements for visibility beyond ensuring the button text is visible.

Primary buttons

Diagram of Button face vs button border

Button face vs button border

  1. Face
  2. Border
Diagram of Canvas vs button border

Canvas vs button border

  1. Canvas
  2. Border
Diagram of Button face vs canvas

Button face vs canvas

  1. Face
  2. Canvas

Secondary and tertiary buttons

Diagram of Button face vs button border

Button face vs button border

  1. Face
  2. Border
Diagram of Canvas vs button border

Canvas vs button border

  1. Canvas
  2. Border
Diagram of Button face vs canvas

Button face vs canvas

  1. Face
  2. Canvas

Containers

Containers, highlight, and dividers

For cards, highlights, dividers, and other visual containers, we want to ensure at a minimum these are visible for all users. To achieve this, we ensure at least a minimum contrast of Lc15.

Diagram of Cards fill vs canvas or  Boundary vs canvas

Cards fill vs canvas or Boundary vs canvas

  1. Canvas
  2. Boundary
  3. Fill
Diagram of Highlighted value fill vs canvas

Highlighted value fill vs canvas

  1. Canvas
  2. Fill

Data visualizations

For data visualizations, we want to ensure that chart segments, lines, and other visual indicators of information are visible at Lc45.

Diagram of Chart segment vs canvas

Chart segment vs canvas

  1. Canvas
  2. Segment
Diagram of Chart line vs canvas

Chart line vs canvas

  1. Canvas
  2. Line