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 🙏

© 2024 – Pkg Stats / Ryan Hefner

material-dynamic-colors

v1.1.2

Published

This project is based on https://material-foundation.github.io/material-theme-builder and uses official color utilities from Material Design.

Downloads

2,930

Readme

Material Dynamic Colors

This project is based on https://material-foundation.github.io/material-theme-builder

Getting Started

CDN

// with html
<script type="module" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn/material-dynamic-colors.min.js"></script>
// with javascript
import "https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn/material-dynamic-colors.min.js";

NPM

# installing
npm i material-dynamic-colors
// importing as window.materialDynamicColors
import "material-dynamic-colors";
// importing as materialDynamicColors
import materialDynamicColors from "material-dynamic-colors";

How to use it?

JS

let colors = await materialDynamicColors(source);

// from color
let colors = await materialDynamicColors("#ffd700");

// from path
let colors = await materialDynamicColors("/image.png");

// from url (caution with cors errors)
let colors = await materialDynamicColors("http://domain.com/image.png");

// from file
let fromFile = document.query("input[type='file']").files[0];
let colors = await materialDynamicColors(file);

// from blob
let fromBlob = new Blob();
let colors = await materialDynamicColors(blob);

Returned object

{
   light:{
      primary: string,
      onPrimary: string,
      primaryContainer: string,
      onPrimaryContainer: string,
      secondary: string,
      onSecondary: string,
      secondaryContainer: string,
      onSecondaryContainer: string,
      tertiary: string,
      onTertiary: string,
      tertiaryContainer: string,
      onTertiaryContainer: string,
      error: string,
      onError: string,
      errorContainer: string,
      onErrorContainer: string,
      background: string,
      onBackground: string,
      surface: string,
      onSurface: string,
      surfaceVariant: string,
      onSurfaceVariant: string,
      outline: string,
      outlineVariant: string,
      shadow: string,
      scrim: string,
      inverseSurface: string,
      inverseOnSurface: string,
      inversePrimary: string,
      surfaceDim: string,
      surfaceBright: string,
      surfaceContainerLowest: string,
      surfaceContainerLow: string,
      surfaceContainer: string,
      surfaceContainerHigh: string,
      surfaceContainerHighest: string
      },
   dark:{
      primary: string,
      onPrimary: string,
      primaryContainer: string,
      onPrimaryContainer: string,
      secondary: string,
      onSecondary: string,
      secondaryContainer: string,
      onSecondaryContainer: string,
      tertiary: string,
      onTertiary: string,
      tertiaryContainer: string,
      onTertiaryContainer: string,
      error: string,
      onError: string,
      errorContainer: string,
      onErrorContainer: string,
      background: string,
      onBackground: string,
      surface: string,
      onSurface: string,
      surfaceVariant: string,
      onSurfaceVariant: string,
      outline: string,
      outlineVariant: string,
      shadow: string,
      scrim: string,
      inverseSurface: string,
      inverseOnSurface: string,
      inversePrimary: string,
      surfaceDim: string,
      surfaceBright: string,
      surfaceContainerLowest: string,
      surfaceContainerLow: string,
      surfaceContainer: string,
      surfaceContainerHigh: string,
      surfaceContainerHighest: string
      }
}

CLI

Do not forget to put your color source between quotes:

material-dynamic-colors "#FF0000"

Output


Generating colors from #FF0000

light theme:
        --primary: #C00100;
        --on-primary: #FFFFFF;
        --primary-container: #FFDAD4;
        --on-primary-container: #410000;
        --secondary: #775651;
        --on-secondary: #FFFFFF;
        --secondary-container: #FFDAD4;
        --on-secondary-container: #2C1512;
        --tertiary: #705C2E;
        --on-tertiary: #FFFFFF;
        --tertiary-container: #FBDFA6;
        --on-tertiary-container: #251A00;
        --error: #BA1A1A;
        --on-error: #FFFFFF;
        --error-container: #FFDAD6;
        --on-error-container: #410002;
        --background: #FFFBFF;
        --on-background: #201A19;
        --surface: #FFF8F6;
        --on-surface: #201A19;
        --surface-variant: #F5DDDA;
        --on-surface-variant: #534341;
        --outline: #857370;
        --outline-variant: #D8C2BE;
        --shadow: #000000;
        --scrim: #000000;
        --inverse-surface: #362F2E;
        --inverse-on-surface: #FBEEEC;
        --inverse-primary: #FFB4A8;
        --surface-dim: #E4D7D5;
        --surface-bright: #FFF8F6;
        --surface-container-lowest: #FFFFFF;
        --surface-container-low: #FEF1EE;
        --surface-container: #F8EBE9;
        --surface-container-high: #F3E5E3;
        --surface-container-highest: #EDE0DD;

dark theme:
        --primary: #FFB4A8;
        --on-primary: #690100;
        --primary-container: #930100;
        --on-primary-container: #FFDAD4;
        --secondary: #E7BDB6;
        --on-secondary: #442925;
        --secondary-container: #5D3F3B;
        --on-secondary-container: #FFDAD4;
        --tertiary: #DEC48C;
        --on-tertiary: #3E2E04;
        --tertiary-container: #564419;
        --on-tertiary-container: #FBDFA6;
        --error: #FFB4AB;
        --on-error: #690005;
        --error-container: #93000A;
        --on-error-container: #FFB4AB;
        --background: #201A19;
        --on-background: #EDE0DD;
        --surface: #181211;
        --on-surface: #EDE0DD;
        --surface-variant: #534341;
        --on-surface-variant: #D8C2BE;
        --outline: #A08C89;
        --outline-variant: #534341;
        --shadow: #000000;
        --scrim: #000000;
        --inverse-surface: #EDE0DD;
        --inverse-on-surface: #362F2E;
        --inverse-primary: #C00100;
        --surface-dim: #181211;
        --surface-bright: #3F3736;
        --surface-container-lowest: #120D0C;
        --surface-container-low: #201A19;
        --surface-container: #251E1D;
        --surface-container-high: #2F2827;
        --surface-container-highest: #3B3332;

License

MIT

Thank you!

Stargazers repo roster for @leonardorafael/material-dynamic-colors