rgba.php

Want to use RGBA in your projects but a solid color fallback for Internet Explorer 8- (and other old browsers) is just not good enough? Do you find that creating fallback semi-transparent pngs is too time-consuming? With rgba.php you get to use RGBA backgrounds in every browser with just one extra CSS declaration! All you need to use it is a server supporting PHP.

How?

background: url('rgba.php/rgba(255, 255, 255, 0.3)');
background: rgba(255, 255, 255, 0.3);

or, for named colors (you specify them, only black and white by default):

background: url('rgba.php?name=black&a=50');
background: rgba(0, 0, 0, 0.5);

The old (v1.1 and below) way of specifying the color also works:

background: url('rgba.php?r=30&g=120&b=0&a=70');
background: rgba(30, 120, 0, 0.7);

Please note:

Get it now from Github

Installation

Just upload the file somewhere. Before you use it, open it with an editor to specify the directory you want it to use to store the created pngs (the default is 'colors/') and add any color names you want to be able to easily address (the defaults are white and black). If the directory you specify does not exist or isn’t writeable you’ll get an error.

History

I wrote the first version of rgba.php as a complement to a blog post on RGBA that I posted on Februrary 2009. Many people seemed to like the idea and started using it. With their valuable input, I made many changes and released v.1.1 (1.1.1 shortly after I posted the article due to another little fix) on October 2009. More than a year after, quite a lot of people still ask me about it and use it, so I decided to make a repo for it on Github and release a new version, with a much easier to use syntax for the URL.

Get it now from Github and stay updated