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

svelte-you-theme-generator

v0.0.3

Published

This is a script to generate material you compatible DCP CSS tokens.

Downloads

103

Readme

Svelte you theme generator

This is a script to generate material you compatible DCP CSS tokens.

It has some additional token to be used with svelte you UI library.


Installation

To install the script use the following command:

npm i -g svelte-you-theme-generator
yarn add -g svelte-you-theme-generator

Library usage

Generate theme from color

Usage: sytg from-color [options] <primary>

Generate material you theme with colors inputs. Compatible with svelte-you.

Arguments:
  primary                                Primary color of palette

Options:
  -v                                     Print current version
  -s, --secondary <color>                Secondary color of palette
  -t, --tertiary <color>                 Tertiary color of palette
  -n1, --neutral <color>                 Neutral color of palette
  -n2, --neutral-variant <color>         Neutral variant color of palette
  -e --error <color>                     Error color of palette
  --full                                 Output complete css files. (Not just theme file)
  -d, --destination <path>               Output path for generated path, default to pwd
  -c --custom <name:color:harmonize...>  Extended colors for palette
  -f --force                             Force entered color, i.e Skip harmonizing color. Useful if brand color needs to be preserved
  -h, --help                             display help for command

Examples

  1. Generate theme file from just primary color
sytg from-color "#6750A4"
  1. Generate theme file in a different folder
sytg from-color "#6750A4" -d /tmp/theme
  1. Generate theme file in a additional colors
sytg from-color "#6750A4" -s "#958DA5" -t "#B58392" -n2 "#939094" -d /tmp/theme
  1. Generate complete theme file, along with supporting css file
sytg from-color "#6750A4" --full
  1. Generate theme file without harmonizing colors
sytg from-color "#6750A4" -s "#958DA5" -f
  1. Add extended colors and harmonize it wih primary color
sytg from-color "#6750A4" -c "spaceGray:#958DA5:true"
  1. Add extended colors and don't harmonize it wih primary color
sytg from-color "#6750A4" -c "spaceGray:#958DA5:false"
  1. Add multiple extended colors
sytg from-color "#6750A4" -c "spaceGray:#958DA5:false" -c "deepRed:#730024:true"

Use in programs

Generate style sheet

import { createStylesheet } from 'svelte-you-theme-generator/lib/index.js';
import { argbFromHex } from 'svelte-you-theme-generator/lib/util/index.js';

const themeCSS = createStylesheet({
  primary: argbFromHex('#6750A4'),
  tones: [
    {
      name: 'spaceGray',
      color: '#423123',
      harmonize: true,
    },
  ],
});

console.log(themeCSS);

Development

This script is built with Node (yarn), TypeScript, Nx.

Development is pretty straightforward:

  • Clone the project
  • Install dependencies yarn install
  • Build the project yarn nx run svelte-you-theme-generator:build
  • To run demo script node libs/svelte-you-theme-generator/demo/index.mjs

License

  • This extension is provided under Apache 2.0 License.

  • This extension is a wrapper around material-color-utilities which is also published under Apache 2.0 License.

  • Shout out to Google Material Team for Material You design system.