npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-material-theme-provider

v0.1.7

Published

Material Design 3 theme token generator for React applications

Readme

Material Theme Provider

A React implementation of Material Design 3 (Material You) theming system. This provider enables dynamic color scheme generation and theme management based on a source color, supporting both light and dark modes. This implementation is using the Material Color Utilities package.

Features

  • Dynamic theme generation from a source color
  • Support for light and dark modes
  • Multiple theme variants (Monochrome, Neutral, Tonal Spot, etc.)
  • Custom color definitions
  • CSS variable-based theme injection
  • Type-safe implementation

Installation

npm install react-material-theme-provider @material/material-color-utilities

Basic Usage

import {MaterialThemeProvider} from 'react-material-theme-provider';

function App() {
    return (
        <MaterialThemeProvider defaultSourceColor="#6D509F" isDark={false}>
            <YourApp/>
        </MaterialThemeProvider>
    );
}

API Reference

MaterialThemeProvider

Props

| Prop | Type | Default | Description | |--------------------|---------------|-----------|------------------------------------| | children | ReactNode | Required | Child components to be wrapped | | defaultSourceColor | string | "#6D509F" | Initial source color in hex format | | isDark | boolean | false | Whether to use dark mode | | customColors | CustomColor[] | [] | Array of custom color definitions |

CustomColor Definition

interface CustomColor {
    name: string;    // Identifier for the custom color
    value: string;   // Hex color value
    blend: boolean;  // Whether to blend with the source color
}

Theme Variants

The system supports multiple theme variants through the Variant enum:

  • MONOCHROME: A Dynamic Color theme that is grayscale. Source
  • NEUTRAL: A Dynamic Color theme that is near grayscale. Source
  • TONAL_SPOT: A Dynamic Color theme with low to medium colorfulness and a Tertiary TonalPalette with a hue related to the source color. Source
  • VIBRANT: A Dynamic Color theme that maxes out colorfulness at each position in the Primary Tonal Palette. Source
  • EXPRESSIVE: A Dynamic Color theme that is intentionally detached from the source color. Source
  • FIDELITY: A scheme that places the source color in Scheme.primaryContainer. Source
  • CONTENT: A scheme that places the source color in Scheme.primaryContainer. Source
  • RAINBOW: A playful theme - the source color's hue does not appear in the theme. Source
  • FRUIT_SALAD: A playful theme - the source color's hue does not appear in the theme. Source

CSS Variables

The theme provider generates and injects CSS variables following the Material Design 3 token system. Here are the key variable categories:

Primary Colors

  • --md-sys-color-primary
  • --md-sys-color-on-primary
  • --md-sys-color-primary-container
  • --md-sys-color-on-primary-container

Secondary Colors

  • --md-sys-color-secondary
  • --md-sys-color-on-secondary
  • --md-sys-color-secondary-container
  • --md-sys-color-on-secondary-container

Tertiary Colors

  • --md-sys-color-tertiary
  • --md-sys-color-on-tertiary
  • --md-sys-color-tertiary-container
  • --md-sys-color-on-tertiary-container

Surface Colors

  • --md-sys-color-surface
  • --md-sys-color-on-surface
  • --md-sys-color-surface-variant
  • --md-sys-color-on-surface-variant

Additional Variables

  • Error colors
  • Background colors
  • Outline colors
  • Surface container variants
  • Fixed variant colors

Hook Usage

import {useMaterialTheme} from './material-theme-provider';

function MyComponent() {
    const {materialTheme, setSourceColor, currentScheme} = useMaterialTheme();

    // Change theme color dynamically
    const handleColorChange = (newColor: string) => {
        setSourceColor(newColor);
    };

    return (
        // Your component implementation
    );
}