HTML API

The following attributes will be placed on the <html> element. These can be used for CSS selectors or JS DOM APIs.

  • data-theme - which will contain the preferred theme keys for each color mode, e.g. light:original would be specifying the key of the preferred theme for light mode is original. Note: any other data contained here is not to be relied upon
  • data-color-mode - will be the color mode to be rendered, e.g. light or dark. This will be updated if the color mode to be used changes
  • data-color-mode-auto - will be present when the color mode should follow the user's browser

Everything else is undefined and should not be relied upon.

Rate this page: