Skip to main content
Elastic UI
Elastic UI
ComponentsPatternsContentData visualization
EUI ChangelogGitHubFigma
  • Guidelines
    • Getting started
    • Accessibility
    • Writing
    • Testing
  • Theming
    • Theme provider
    • Color mode
    • High contrast mode
    • Borders
    • Breakpoints
    • Colors
    • Sizing
    • Typography
  • Templates
    • Page template
    • Sitewide search
  • Layout
    • Accordion
    • Bottom bar
    • Flex
    • Flyout
    • Header
    • Horizontal rule
    • Modal
    • Page components
    • Page header
    • Panel
    • Popover
    • Resizable container
    • Spacer
  • Navigation
    • Breadcrumbs
    • Buttons
    • Collapsible nav
    • Context menu
    • Facet
    • Key pad menu
    • Link
    • Pagination
    • Side nav
    • Steps
    • Tabs
    • Tree view
  • Display
    • Aspect ratio
    • Avatar
    • Badge
    • Callout
    • Card
    • Comment list
    • Description list
    • Drag and drop
    • Empty prompt
    • Health
    • Icons
    • Image
    • List group
    • Loading
    • Progress
    • Skeleton
    • Stat
    • Text
    • Timeline
    • Title
    • Toast
    • Tooltip
    • Tour
  • Forms
    • Form controls
    • Form layouts
    • Form validation
    • Text controls
    • Numeric controls
    • Selection controls
    • Search and filter controls
    • Date and time controls
    • Other controls
  • Tabular content
    • Tables
    • Data grid
  • Editors & Syntax
    • Code
    • Markdown
  • Utilities
    • Accessibility
    • Auto sizer
    • Beacon
    • Color palettes
    • Copy
    • CSS utility classes
    • Delay
    • Error boundary
    • Focus trap
    • Highlight and mark
    • HTML ID generator
    • I18n
    • Inner text
    • Mutation observer
    • Outside click detector
    • Overlay mask
    • Portal
    • Pretty duration
    • Provider
    • Resize observer
    • Scroll
    • Text diff
    • Text truncation
    • Window events
  • EUI
  • Theming
  • High contrast mode

High contrast mode Beta

The

highContrastMode determines and sets certain un-overrideable modifications to the EUI theme, primarily around borders and shadows. Borders will always be pure black or white (depending on the color mode), and shadows will be entirely replaced with borders.

By default, if this prop is not passed, EuiProvider will detect and use the user's system contrast preferences.

Rendering a specific contrast mode

While it's usually best to keep all high contrast mode the same across your app for visual consistency, some instances may benefit from an exaggerated change in contrast. For this you can set EuiThemeProvider's highContrastMode to true.

In general, we do not ever recommend manually turning off high contrast via highContrastMode={false}. Respect the user's contrast preferences where possible.

Loading...

Forced contrast themes and colors

Please note that some OSes and browsers have something called

forced colors mode, which overrides all colors, backgrounds, borders, and shadows. An example of this is Windows High Contrast modes.

Since this is done at a level that EUI can do nothing about, if forced colors mode is detected by EuiProvider, EUI will ignore any passed highContrastMode or colorMode prop, as this user choice and system setting takes precedence.

To quickly test your application in forced colors mode without switching OS themes, you can use Chrome or Edge's devtools to emulate forced-colors mode.

Reacting to user high contrast modes

The detected or current highContrastMode is available via useEuiTheme(). It returns either "forced", "preferred", or simply false. You can use this information to (for example) conditionally render or opt out of rendering certain styles or colors.

Loading...
Edit this page

Previous
Color mode
Next
Borders
  • Rendering a specific contrast mode
  • Forced contrast themes and colors
  • Reacting to user high contrast modes
EUI is dual-licensed under Elastic License 2.0 and Server Side Public License, v 1 | Crafted with ❤ by Elastic