I have just learned that it is no longer recommended to use math operators to compute colors in Sass stylesheets. It so happens that I have a block of code that computes colors using addition, subtraction and multiplication, but it is causing postcss
to produce deprecation warnings:
// Extension to Bootstrap's base colors
$gray-25: $gray-100 + ((#fff - $gray-100) / 4) * 3;
$gray-50: $gray-100 + ((#fff - $gray-100) / 4) * 2;
$gray-75: $gray-100 + ((#fff - $gray-100) / 4);
$gray-150: $gray-100 + (($gray-200 - $gray-100) / 2);
The actual warnings are:
DEPRECATION WARNING on line 4 of /path/to/scss/_variables.scss:
The operation `#fff minus #f8f9fa` is deprecated and will be an error in future versions.
Consider using Sass's color functions instead.
http://sass-lang.com/documentation/Sass/Script/Functions.html#other_color_functions
I had a look at the color
package but there does not seem to be an easy way of calculating a color based off another using simple math operators.
How would I go about fixing these deprecation warnings?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…