ColorScheme

A JSX email component which provides meta and style foundations for color scheme support

Tips

Please be sure to read our FAQ about Dark Mode in the context of email templates: https://jsx.email/docs/faq#dark-and-light-mode

pnpm
aube
bun
npm
yarn
pnpm add jsx-email

Usage

Add the component to your email template.

import { Body, ColorScheme, Head, Html } from 'jsx-email';

const Email = () => {
  return (
    <Html>
      <Head>
        <ColorScheme mode="light only" />
      </Head>
      <Body></Body>
    </Html>
  );
};

Which will produce the following HTML:

<html>
  <head>
    <meta name="color-scheme" content="light only" />
    <meta name="supported-color-schemes" content="light only" />
    <style>
      :root {
        color-scheme: light only;
        supported-color-schemes: light only;
      }
    </style>
  </head>
  <body></body>
</html>

Component Props

export interface ColorSchemeProps {
  mode?: Mode;
}

Individual Props

mode?: ColorSchemeMode;

Default: 'normal'

Selects the color scheme mode that informs the email client which mode to render.

Supported Values: