Skip to content

kaplanerkan/autumn

 
 

Repository files navigation

Autumn.js

Autumn generates deterministic colors. It's great for coloring tags, navigation, and icons (this post demonstrates one such use case).

Using Autumn

Include jQuery, HUSL (optional, but recommended), and Autumn.

<script src="jquery-1.10.1.min.js"/>
<script src="husl.min.js"/>
<script src="autumn.min.js"/>

Then color as many elements as you want with a single line:

$("div").autumn();

Demo

Why Autumn?

Generating random colors is fairly easy:

function randomColor(){
    return 'hsl('+Math.random()*360+',100%,60%)';
}

But generating lots of deterministic colors that look great together is a bit harder. Autumn has the following goals:

  • Colors shouldn't interfere with text readability.
  • Colors in a sequence should be easily distinguishable, especially consecutive colors.
  • Colors should repeat infrequently.

Judge for yourself on the color profile demo.

API

Here.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors