0.3.0 • Published 12 months ago

@material/material-color-utilities v0.3.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
12 months ago

material-color-utilities

npm package

Algorithms and utilities that power the Material Design 3 (M3) color system, including choosing theme colors from images and creating tones of colors; all in a new color space.

See the main README for more information.

Getting started

npm i @material/material-color-utilities or yarn add @material/material-color-utilities

import { Hct } from "@material/material-color-utilities";

// Simple demonstration of HCT.
const color = Hct.fromInt(0xff4285f4);
console.log(`Hue: ${color.hue}`);
console.log(`Chrome: ${color.chroma}`);
console.log(`Tone: ${color.tone}`);

Theming

import { argbFromHex, themeFromSourceColor, applyTheme } from "@material/material-color-utilities";

// Get the theme from a hex color
const theme = themeFromSourceColor(argbFromHex('#f82506'), [
  {
    name: "custom-1",
    value: argbFromHex("#ff0000"),
    blend: true,
  },
]);

// Print out the theme as JSON
console.log(JSON.stringify(theme, null, 2));

// Check if the user has dark mode turned on
const systemDark = window.matchMedia("(prefers-color-scheme: dark)").matches;

// Apply the theme to the body by updating custom properties for material tokens
applyTheme(theme, {target: document.body, dark: systemDark});

Contributing

This repo is not accepting external contributions, but feature requests and bug reports are welcome on GitHub.

@peyrani/weave-ui@everything-registry/sub-chunk-584tw-material3-plugintailwindcss-m3-plugintailwindcss-material3-plugintailwind-m3-colorstailwind-materialtailwind-material-colorssvelte-you-theme-generatortemp-theme@dotdirewolf/mui-m3-theme@color-kit/palette@pchmn/expo-material3-themekitchen-color-studio@ndiinginc/material@sinskiy/postcss-material-colors@bytesquid/use-material-themesolid-create-material-themesolid-material-colortypedoc-material-themetvision-color@bhunter179/react-material-you-theme@citizendev/bubble-multi-select@claas.dev/material-tailwind@codomatech/bulma50shadesvuetialunocss-preset-materialuse-material-you@fusion-ui-vue/theme@goevery/material-theme-tailwind@infinitebrahmanuniverse/nolb-_mate@initiative.dev/ide@exmg/exmg-theme@exmg/exm-theme@material-solid/vanilla-extract@miitvip/admin-pro@joyfour/design-system@jsonxr/material3@jsprismarine/typedoc-material-theme@inbeg-m3/color@imsyy/color-utils@react-m3/source@poupe/theme-builder@salsita/salsa-ui@paulobrandao/react-material@plexigraph/plex-ui@solidjs-material/tailwind@star4/theme@star4/vanilla-extract@sinskiy/tailwind-material-colors@sixui/uimikanuiomar-hassan-test1ogienchatoolibosykareact-lib-salah-zanatireact-native-material3-themenextline-webpostcss-color-hctpostcss-material-colorssober-themegomdoreelab-lib-material-webim-writing-componentsliftkit-tailwindcssmaterial-chalkmaterial-design-3-theme-buildermaterial3-stylemd3-reactm3rm3-sveltem3-tailwind-colorsm3-tailwind-typographym3-tokenskoishi-plugin-material-you-themematerial-color-schemematerial-color-web-componentmaterial-dynamic-colorsmdui@weave-ds/react@weavy/dropin-js@weavy/uikit-web@wog890/wog-color@webformula/material@typo13/ty-ui@udixio/tailwind-material@udixio/theme@udixio/ui@tw-material/theme@universal-material/web@thewebformula/materially@yetaanother/react-native-material-you@yrpri/webapp@zationdev/uiafter-nightfall-common-coreadaptive-colorsadwaita-materialuantd-color-editorastro-material-designdarwebcomponents
0.3.0

12 months ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.1

2 years ago

0.2.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago