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

sass-gradient-patterns

v0.1.6

Published

CSS3 gradient pattern Sass mixins

Downloads

16

Readme

Mixins for CSS3 Gradient Patterns

sass-gradient-patterns is a collection of Sass mixins that allow you to easily customize the CSS3 gradient patterns found in Lea Verou's Patterns Gallery, Bennett Feely's background-blend-mode pattern gallery and more.

Check out the interactive tool for customizing (and animating!) these mixins

How to use it

  1. Install with npm: npm install sass-gradient-patterns --save

    OR Download _gradient_patterns.scss to your Sass project.

  2. Import the partial in your Sass files: @import 'gradient_patterns';

  3. Use any of the pattern mixins (see here for a list of all mixins, see below for some typical usage examples)

Included patterns

Here is a list of all of the included mixins (grouped by source gallery) and their keyword parameters. All patterns from Lea Verou's and Bennett Feely's galleries are included.

Usage/customizing

All of the mixins accept keyword parameters (listed here by mixin) so that you can easily tweak individual aspects (eg colors, angles, sizes) of the pattern. Or just include the mixin with no arguments for the default version of the pattern found in the original gallery.

The $scale parameter is accepted by most of the mixins to control the overall repeating pattern size.

The $set-relative parameter is accepted by some mixins to allow setting the value of one parameter to control the value of some other parameters (mostly used for generating nice relative color combinations).

For example, let's look at the diagonal-stripes mixin (from Lea Verou's pattern).

To include the original pattern as-is, simply include the mixin:

@import 'gradient_patterns';

.selector {
  @include diagonal-stripes;
}

diagonal-stripes allows you to customize:

  • either of the colors - $background-color defaults to gray and $stripe-color defaults to semi-transparent white rgba(255, 255, 255, .5)
  • the $angle of the stripes (defaults to 45deg)
  • like most patterns, the $scale of the overall pattern (here, defaults to 70px)
  • the $stripe-width (defaults to 50% - this is not a literal CSS percentage value, but rather a percentage relative to the $scale)

So to make the stripes more purplish and enlarged, we could instead do:

.selector {
  @include diagonal-stripes($background-color: mediumorchid, $scale: 100px);
}

Or if we want the stripes to go towards the bottom right and for the darker stripes to be thinner:

.selector {
  @include diagonal-stripes($angle: 135deg, $stripe-width: 70%);
}

Most of the mixins follow similar conventions.

Help

If you have questions about how to use any of these mixins, feel free to open a Github issue

Contributing

Got more patterns to contribute? Or want to add more parameters to an existing pattern? Feel free to open a pull request on Github. Please try and follow the Sassdoc conventions if you can so that the documentation and interactive tool will update seamlessly. Or just open an issue with a link to a pattern you think is cool and I'll see if I can implement it.

Compatibility

These patterns use CSS3 gradients (linear-gradient(), radial-gradient(), repeating-linear-gradient(), repeating-radial-gradient()) so depend on browser support, see eg caniuse

License

MIT