Implement tint and shade functions

This commit is contained in:
Synchro
2012-09-12 18:49:21 +02:00
committed by Luke Page
parent 8019439eb4
commit f8bee84fdf
3 changed files with 18 additions and 0 deletions

View File

@@ -304,6 +304,12 @@ tree.functions = {
var g = 255 - Math.abs(255 - color2.rgb[1] - color1.rgb[1]);
var b = 255 - Math.abs(255 - color2.rgb[2] - color1.rgb[2]);
return this.rgb(r, g, b);
},
tint: function(color, amount) {
return this.mix(this.rgb(255,255,255), color, amount);
},
shade: function(color, amount) {
return this.mix(this.rgb(0, 0, 0), color, amount);
}
};

View File

@@ -54,6 +54,12 @@
roundedpx-three: 3.333px;
percentage: 20%;
color: #ff0011;
tint: #898989;
tint-full: #ffffff;
tint-percent: #898989;
shade: #686868;
shade-full: #000000;
shade-percent: #686868;
mix: #ff3300;
mix-0: #ffff00;
mix-100: #ff0000;

View File

@@ -59,6 +59,12 @@
roundedpx-three: round(10px / 3, 3);
percentage: percentage(10px / 50);
color: color("#ff0011");
tint: tint(#777777, 13);
tint-full: tint(#777777, 100);
tint-percent: tint(#777777, 13%);
shade: shade(#777777, 13);
shade-full: shade(#777777, 100);
shade-percent: shade(#777777, 13%);
mix: mix(#ff0000, #ffff00, 80);
mix-0: mix(#ff0000, #ffff00, 0);