What is this?
Rainbow is a CSS library for pretty, colorful buttons. It comes with sources written in Sass for easy customization. No dependencies on any other third party library. Here's a few examples (scroll down for more):
How do I get it?
You can download it right from this page or you can clone it from GitHub:
Rainbow is licensed under a Creative Commons Attribution 4.0 International License, which means you can freely share and/or modify it for both personal and commercial applications. The only requirement is that you keep the original attribution (the comment at the top of the CSS file).
How do I use it?
If you want to use the library as-is, with just the default buttons (showcased below) then all you need is the CSS file. Include it in your header:
To create a basic button, all you need to do is use the base rainbow class .rb:
The library includes a few additional styles: selected, disabled, small and grouped buttons. You get 12 colors included by default, listed below. For a colorful button, include the base class and the desired color:
What's included in the library?
Below you'll find all the button styles and colors included in the library. Every button should have the base rainbow button class .rb. All the other classes add colors or presentation styles and are meant to be used together with the base. To keep the examples uncluttered, only the additional classes are listed.
By default the buttons do not have a fixed width, so they will expand according to their text. Feel free to set one in your own styles if you need to (as these examples have).
There are a few common class names that are sometimes injected by javascript libraries which do not use the rainbow prefix rb-: selected, disabled, small.
Basic buttons
Extra styles
Basic colors
Extra colors
How do I add my own colors?
If you'd like more customization - including defining your own colors - then download the full archive. You'll find inside the Sass source file that can be imported into your own stylesheets.
1. In your project's Sass stylesheet, add the following import at the top:
Since you're importing Rainbow into your own stylesheet, you no longer need to include its CSS file in your header (as in the basic use example above). Get rid of it.
2. Define your own selector and call the rainbow-button mixin with your custom color:
3. Build the stylesheet and you're good to go. Now you can use your custom color from the compiled CSS:
That's it! Enjoy using Rainbow!
Who are you again?
I'm a software engineer looking to fill my free time with little projects like this one. For more - or to contact me - head over to my home page.