Skip to main content
react-md

useColorSchemeMetaTag

function useColorSchemeMetaTag(options: ColorSchemeMetaTagOptions): void;

Adds a <meta name="color-scheme" content="light"> or <meta name="color-scheme" content="dark"> into the head element.

This should not be used if you are using the useColorSchemeProvider since it is already built in.

Example Usage

import { useColorScheme } from "@react-md/core/theme/useColorScheme";
import { useColorSchemeMetaTag } from "@react-md/core/theme/useColorSchemeMetaTag";

function Example() {
  const { currentColor } = useColorScheme();
  useColorSchemeMetaTag({ colorScheme: currentColor });

  return null;
}

Parameters

export interface ColorSchemeMetaTagOptions {
  /** @defaultValue `"false"` */
  disabled?: boolean;
  colorScheme: "light" | "dark";
}

Returns

Nothing.

See Also