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
  • Color mode

Color mode

The

colorMode determines which values to return based on LIGHT or DARK mode.

By default, if this prop is not passed, EuiProvider will detect and use the user's system dark mode preference. If the prop is passed, it will override the user's system settings.

colorMode:LIGHT

Rendering a specific color mode

While it is usually best to keep all consumptions of the global variables rendering in the same light or dark color mode, some instances benefit from an exaggerated change in contrast from the current theme. For this you can specify EuiThemeProvider's colorMode to always be "light", "dark", or "inverse" which sets it to the opposite of the current color mode.

When nesting or overriding EuiThemeProvider, a wrapping <span> element that sets the correct default text color (normally set at the global <body> level) will be rendered. You can customize the display of this wrapping element by passing wrapperProps.

Alternatively, if a wrapper will significantly impact the DOM layout/flow of your content, and if your child is a single React component, you may pass wrapperProps={{ cloneElement: true }} to avoid rendering an extra wrapper and to clone the correct color classes onto your child content.

Loading...

Using color tokens in a specific color mode

The following example demonstrates how you can use color tokens in any of the color modes: "light", "dark", or "inverse".

Loading...
Edit this page

Previous
Theme provider
Next
High contrast mode
  • Rendering a specific color mode
  • Using color tokens in a specific color mode
EUI is dual-licensed under Elastic License 2.0 and Server Side Public License, v 1 | Crafted with ❤ by Elastic