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

md-colors

v1.0.0

Published

Material Design's colors as SASS variables, extensions, or functions

Downloads

31

Readme

md-colors

Material Design's colors as SASS variables, extensions, or functions

npm package ![][dl-badge]

Install

npm install md-colors
# or
bower install md-colors

Usage

@import 'md-colors'

// declare variables
$primary   : md-color('blue', '300')
$secondary : md-color('red', 'a300')

// via Function
.eg--function
	color: md-color('deep-purple', '50')
	background-color: md-color('indigo') // '500' is default shade
	box-shadow: 0 1px 3px rgba(md-color('lime'), 0.2)

// via Extension
.eg--placeholder
	@extend %md-color-deep-purple-50
	@extend %md-bg-color-indigo-500
	// No built-in extension for 'box-shadow'. Use a function

Colors

All of md-color's colors are taken from the Material Design Color Palette.

All names and values are stringified (within functions) and lowercased. For example:

// function
color: md-color('light-blue', 'a100')
background-color: md-color('green', '600')

// extension/placeholder
@extend %md-color-lime-a200
@extend %md-bg-color-red-300

Importing

You have two options for easy importing:

  • Attach node_modules or bower_components to the includePaths option of your SASS compiler
  • Use a sass importer function, as described here or as exemplified here

Function

SASS functions can be anywhere as if they were normal variables or values.

The md-color function takes two parameters:

name

Type: string

The lowercased (and hypened) color name; eg: red, light-purple

shade

Type: string Default: 500

The shade or weight of the color; eg: 50, 300, a100

Extensions

By nature, extensions, or "placeholders", don't offer too much without inordinate amounts of complexity. So there are only two sets of built-in extensions for backgrounds and colors.

If you want a text-color extension, the format is:

%md-color-{ name }-{ shade }

If you want a background color extension, the format is:

%md-bg-color-{ name }-{ shade }

For example:

body
	@extend %md-color-deep-purple-50
	@extend %md-bg-color-indigo-500

.test
	position: relative
	@extend %md-color-deep-purple-50
	@extend %md-bg-color-indigo-500

Output:

body,
.test {
	color: #EDE7F6; }
body,
.test {
	background-color: #3F51B5; }
.test {
	position: relative; }

License

MIT © Luke Edwards