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

dynamic-colors

v1.1.5

Published

Dynamic Colors is a JavaScript library that can dynamically generate color palettes from a single HEX color and it provides a range of useful APIs for creating, managing, and manipulating color palettes.

Downloads

16

Readme

Dynamic Colors

Dynamic Colors is a JavaScript library that can dynamically generate color palette from a single HEX color and it provides a range of useful APIs for creating, managing, and manipulating color palettes such as create(), remove(), setAutoTheme(), setDarkTheme(), setLightTheme(), themeCycle(), isInstance().

Installation

npm (scoped) npm bundle size (scoped) npm jsDelivr hits (npm scoped)

To install Dynamic Colors using npm, run the following command:

npm i dynamic-colors

Alternatively, you can include Dynnamic Colors's IIFE file in your website using a <script> tag:

<script src="https://cdn.jsdelivr.net/gh/patelka2211/[email protected]/DynamicColors.js"></script>

Available APIs

create()

The create() function creates a new instance of the DynamicColors class, which is used to manage color palettes.

| | Available as | | :------ | :--------------------- | | in ESM | create() | | in IIFE | DynamicColors.create() |

remove()

The remove() function is used to unsubscribe an instance of the DynamicColors class from all available DynamicColors instances. By calling this function with the desired instance as an argument, you can effectively remove the instance's association with the color palettes managed by Dynamic Colors.

| | Available as | | :------ | :--------------------- | | in ESM | remove() | | in IIFE | DynamicColors.remove() |

setAutoTheme()

The setAutoTheme() function subscribes all instances of the DynamicColors class to automatically change the theme based on the user's operating system theme.

| | Available as | | :------ | :--------------------------- | | in ESM | setAutoTheme() | | in IIFE | DynamicColors.setAutoTheme() |

setDarkTheme()

The setDarkTheme() function changes all instances of the DynamicColors class to a dark theme.

| | Available as | | :------ | :--------------------------- | | in ESM | setDarkTheme() | | in IIFE | DynamicColors.setDarkTheme() |

setLightTheme()

The setLightTheme() function changes all instances of the DynamicColors class to a light theme.

| | Available as | | :------ | :---------------------------- | | in ESM | setLightTheme() | | in IIFE | DynamicColors.setLightTheme() |

themeCycle()

The themeCycle() function cycles through different themes based on the current theme:

| | Available as | | :------ | :------------------------- | | in ESM | themeCycle() | | in IIFE | DynamicColors.themeCycle() |

  • If the current theme is Auto, the next theme will be Light.
  • If the current theme is Light, the next theme will be Dark.
  • If the current theme is Dark, the next theme will be Auto.

isInstance()

Determines whether the given object is an instance of DynamicColors. Returns true if the object is an instance of DynamicColors, otherwise false.

Internally used functionalities

DynamicColors class

The DynamicColors class is used internally by Dynamic Colors to manage the color palettes it generates. It has the following characteristics:

The DynamicColors class is created using the create() function and can only be removed using the remove() function.

Material Dynamic Colors

Dynamic Colors leverages the power of Material Dynamic Colors internally to generate color palettes. It builds upon the functionality provided by Material Dynamic Colors and offers additional features. With Dynamic Colors, you can go beyond the basic color generation and enjoy advanced functionalities tailored to your specific needs, enabling you to create dynamic visual experiences for your web applications.

License

NPM

This project is licensed under the MIT License, which permits you to use, copy, modify, merge, publish, distribute, and sublicense the software, subject to the conditions stated in the LICENSE file.