Skip to content

User preferences

Iris CSS follows the settings users choose in their system, with no setup.

PreferenceWhat Iris CSS does
prefers-color-schemeUses the light or dark colors. See themes.
prefers-reduced-motion: reduceMakes Iris CSS transitions 1ms long, so they finish at once but still fire transitionend. Smooth scrolling, the skeleton shimmer and the indeterminate progress bar stop. Loading spinners keep turning, since they carry meaning.
prefers-reduced-transparency: reduceRemoves the blur behind modals and drawers.
prefers-contrast: moreWider borders on form controls and table headers, a wider focus ring, and rules in the text color.
forced-colors: activeUnderlines links, borders buttons, drops shadows and uses system colors for focus, disabled text, highlights and icons.

Testing

Browser developer tools can fake each preference. In Chrome and Edge, open the command menu and search for "Rendering", then pick the media feature to emulate. Firefox and Safari have similar settings.

Your own styles

Iris CSS sets its duration and blur variables for these preferences with !important, so your own value for --i-duration cannot bring the motion back. Your own animations are yours to handle: run them only when the user has no motion preference.

@media (prefers-reduced-motion: no-preference) {
  .hero { animation: fade-in 0.6s ease-out; }
}

For motion done with JavaScript, such as a parallax effect, check the same media query.

const reduceMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;

Variables

VariableDefault
--i-contrast-border-width0.125rem
--i-contrast-focus-ring-width0.1875rem
--i-border-widthvar(--i-contrast-border-width)
--i-focus-ring-widthvar(--i-contrast-focus-ring-width)