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

@guyn-style/color

v0.1.0-alpha.14

Published

Guyn Style Color Module

Downloads

1

Readme

Color

The philosophy

Guyn comes with two predefined colorsets; default and social. All colors are easy to change, extend, or overwrite with another colorset. Normally colors are defined as variables in SCSS, we decided that a color function is much more powerful.

The function

The basic function to show a color is color(Red), but in Guyn it's also possible to use it to define the opacity or use another colorset.

// Standard function:
background-color: color(Red); // outputs: background-color: #eb0f33;

// Using the opacity property:
background-color: color(
	Red,
	0.5
); // outputs: background-color: rgba(235, 15, 51, 0.5);

// Using a different colorset:
background-color: color(
	Red,
	1,
	"vibrant"
); // outputs: background-color: #fe5165;

Add your own

Add your own colorset by passing a map. Colors should not have the same name as existing html color names, you can only use them if you capitalize them.

// To create a new colorset and overwrite the default at the same time:
$default-color-set: (
	"Black": #111111,
	"White": #f7f7f7,
	"myBlue": #181160,
	"fireRed": #ed1f35,
);
// NB The new default colorset has to at least contain Black and White.

// Choose a unique variable name to create a new colorset:
$custom-colors: (
	"Black": #111111,
	"White": #f7f7f7,
	"myBlue": #181160,
	"fireRed": #ed1f35,
);

Overwrite

To overwrite the default colorset and add your own:

$default-color-set: "vibrant";

::: tip Include this before the import of @import '~henris' :::

SCSS color function

The colors from the colorsets are all usable in the standard SCSS color functions:

// syntax:
color: darken(colorName, $amount);

// example
color: darken(fireRed, 10%);

Default color variables

| Variable | Default value | Use | | -------------------------------------- | ------------------ | ----------------------------------------------------- | | $color-dark | color(Black) | Mainly used for text colors and backgrounds | | $color-light | color(White) | Mainly used for text colors and backgrounds | | $color-primary/ $primary-color | color(Purple) | The main color in your project, f.e. your brand color | | $color-secondary/ $secondary-color | color(Blue) | The complementary color in your project | | $color-tertiary/ $tertiary-color | color(Pink) | An extra complementary color in your project | | $color-link | color(Blue) | Links | | $color-info | color(Turquoise) | Information blocks or texts | | $color-success | color(Green) | Success messages | | $color-warning | color(Orange) | Warning messages | | $color-danger | color(Red) | Danger / error messages |

Default colorsets

$color-default: (
	"Black": #101010,
	"Dark": #303030,
	"White": #ffffff,
	"Offwhite": #f7f7f7,
	"Gray": #7f7f7f,
	"Green": #10c565,
	"Blue": #1eb3e0,
	"Red": #eb0f33,
	"Brown": #aa834f,
	"Yellow": #f5c505,
	"Orange": #f6790b,
	"Pink": #ca1387,
	"Purple": #7329b1,
	"Turquoise": #3feac3,
) !default; //

$color-social: (
	"dribbble": #ea4c89,
	"facebook": #3b5998,
	"flickr": #ff0084,
	"foursquare": #0072b1,
	"git": #0f0d0e,
	"googleplus": #dd4b39,
	"twitter": #00aced,
	"linkedin": #007bb6,
	"instagram": #517fa4,
	"pinterest": #cb2027,
	"skype": #12a5f4,
	"snapchat": #fffc00,
	"soundcloud": #ff7700,
	"spotify": #2ebd59,
	"tumblr": #32506d,
	"vimeo": #aad450,
	"vine": #00bf8f,
	"vkontakte": #45668e,
	"youtube": #bb0000,
	"wordpress": #21759b,
) !default; //

Default colorset

These are the colors set by default in Guyn. All colors can be easily overwritten as you can read above.

Contra

The function

Contra returns the opposite color of a given value.

For instance, you create a list with colors. The background will get the colors of the list and the text will get the color which suits best.

.element {
	@each $color-name, $color-value in $colors {
		&--#{to-lower-case($color-name)} {
			background-color: $color-value;
			color: contra($color-value);
		}
	}
}

| Argument | Default | Description | | ----------- | ------- | ------------------------------------------------------------------------ | | $value | | The input color to be checked for lightness | | $opacity | 1 | Returned opacity of the color | | $colors | null | A map with a alternate black and white color can be given | | $contrast | 57.5 | Contrast used to determine whether black or white should be passed back. |

$colors

If you want to return an alternate black or white color (the black and white defined in the $colors are default) you can pass a list with colors.

.element {
	@each $color-name, $color-value in $colors {
		&--#{to-lower-case($color-name)} {
			background-color: $color-value;
			color: contra($color-value, 1, ("red", "green"));
		}
	}
}