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

mdui-v2-material-color-utilities

v0.0.1

Published

A wrapper of material-color-utilities for mdui v2

Readme

MDUI v2 Material Color Utilities

MDUI v2自带的配色工具太丑了,配出来的颜色不如Google的原版material-color-utilities好看,于是有了这个项目,将Google原版配色工具应用到mdui v2中。

这是一个基于 @material/material-color-utilities 的包装库,用于在 MDUI v2 中方便地应用 Material Design 3 的动态颜色主题。

安装

npm install mdui-v2-material-color-utilities

使用方法

基本用法

import { argbFromHex, themeFromSourceColor, mduiApplyTheme } from 'mdui-v2-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));

// 应用主题到整个文档
mduiApplyTheme(theme);

// 应用主题到特定元素
mduiApplyTheme(theme, {
  target: document.querySelector('.my-element')
});

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

// 应用暗色主题
mduiApplyTheme(theme, {
  dark: systemDark
});

高级用法

你可以同时生成亮色和暗色主题的 CSS 变量:

mduiApplyTheme(theme, {
  brightnessSuffix: true
});

这将生成如下格式的 CSS 变量:

  • --mdui-color-* - 当前主题的颜色
  • --mdui-color-*-light - 亮色主题的颜色
  • --mdui-color-*-dark - 暗色主题的颜色

API

mduiApplyTheme(theme, options?)

应用主题到指定元素。

参数:

  • theme: Material Design 主题对象
  • options: 可选配置
    • dark: 是否使用暗色主题(默认:false
    • target: 目标 HTML 元素(默认:document.body
    • brightnessSuffix: 是否同时生成亮色和暗色主题的 CSS 变量(默认:false

直接访问原始工具

该库导出了所有来自 @material/material-color-utilities 的工具函数,你可以直接使用它们:

import { argbFromHex, themeFromSourceColor } from '@mdui/material-color-utilities';

License

MIT