mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
Soft light blending mode added.
This commit is contained in:
committed by
Luke Page
parent
6696368eb3
commit
6e97b8f694
@@ -237,6 +237,18 @@ tree.functions = {
|
||||
},
|
||||
_isa: function (n, Type) {
|
||||
return (n instanceof Type) ? tree.True : tree.False;
|
||||
},
|
||||
|
||||
/* Blending modes */
|
||||
|
||||
softlight: function(color1, color2) {
|
||||
var t = color2.rgb[0] * color1.rgb[0] / 255;
|
||||
var r = t + color1.rgb[0] * (255 - (255 - color1.rgb[0]) * (255 - color2.rgb[0]) / 255 - t) / 255;
|
||||
t = color2.rgb[1] * color1.rgb[1] / 255;
|
||||
var g = t + color1.rgb[1] * (255 - (255 - color1.rgb[1]) * (255 - color2.rgb[1]) / 255 - t) / 255;
|
||||
t = color2.rgb[2] * color1.rgb[2] / 255;
|
||||
var b = t + color1.rgb[2] * (255 - (255 - color1.rgb[2]) * (255 - color2.rgb[2]) / 255 - t) / 255;
|
||||
return this.rgb(r, g, b);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user