Skip to content

Commit

Permalink
Allow for '%' unit type in the 'alpha' of rgba and hsla
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt committed Feb 22, 2012
1 parent e7ee09c commit d35cde7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ var typeMap = {
*/

exports.hsla = function hsla(hue, saturation, lightness, alpha){
if ( alpha !== undefined && alpha !== null && alpha.type === "%" ) alpha.val /= 100
switch (arguments.length) {
case 1:
utils.assertColor(hue);
Expand Down Expand Up @@ -247,6 +248,7 @@ exports.blue = function blue(color){
*/

exports.rgba = function rgba(red, green, blue, alpha){
if ( alpha !== undefined && alpha !== null && alpha.type === "%" ) alpha.val /= 100
switch (arguments.length) {
case 1:
utils.assertColor(red);
Expand Down
4 changes: 4 additions & 0 deletions test/cases/literal.color.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ body {
color: rgba(255,204,0,0.40);
color: #fff;
color: rgba(255,255,255,0.50);
color: rgba(3,3,3,0.75);
color: rgba(3,3,3,0.75);
color: rgba(50,50,50,0.75);
color: rgba(50,50,50,0.75);
}
4 changes: 4 additions & 0 deletions test/cases/literal.color.styl
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ body
color: #ffcc0066
color: rgb(100%,255,100%)
color: rgba(100%,255,100%,0.5)
color: hsla(1,1,1,0.75)
color: hsla(1,1,1,75%)
color: rgba(50,50,50,0.75)
color: rgba(50,50,50,75%)

0 comments on commit d35cde7

Please sign in to comment.