fadeout method
Increase the transparency (or decrease the opacity) of a color, making it less opaque.
Parameters: color: A color object. amount: A percentage 0-100%. method: Optional, set to relative for the adjustment to be relative to the current value. Returns: color Example: fadeout(hsla(90, 90%, 50%, 0.5), 10%) Output: rgba(128, 242, 13, 0.4) // hsla(90, 90%, 50%, 0.4)
Implementation
Color fadeout(Node color, Dimension amount, [Keyword method]) {
final hsl = toHSL(color);
hsl
..a -= (method?.value == 'relative')
? hsl.a * amount.value / 100
: amount.value / 100
..a = clamp(hsl.a);
return hslaColorSpace(color, hsl);
// 3.9.0 20190711
// fadeout: function (color, amount, method) {
// var hsl = toHSL(color);
//
// if (typeof method !== 'undefined' && method.value === 'relative') {
// hsl.a -= hsl.a * amount.value / 100;
// }
// else {
// hsl.a -= amount.value / 100;
// }
// hsl.a = clamp(hsl.a);
// return hsla(color, hsl);
// },
}