@@ -23,7 +23,8 @@ final _microsoftFilterStart = RegExp(r'^[a-zA-Z]+\s*=');
23
23
/// The global definitions of Sass color functions.
24
24
final global = UnmodifiableListView ([
25
25
// ### RGB
26
- _red, _green, _blue, _mix,
26
+ _red.withDeprecationWarning ('color' ), _green.withDeprecationWarning ('color' ),
27
+ _blue.withDeprecationWarning ('color' ), _mix.withDeprecationWarning ('color' ),
27
28
28
29
BuiltInCallable .overloadedFunction ("rgb" , {
29
30
r"$red, $green, $blue, $alpha" : (arguments) => _rgb ("rgb" , arguments),
@@ -66,10 +67,13 @@ final global = UnmodifiableListView([
66
67
red: 255 - color.red, green: 255 - color.green, blue: 255 - color.blue);
67
68
68
69
return _mixColors (inverse, color, weight);
69
- }),
70
+ }). withDeprecationWarning ( 'color' ) ,
70
71
71
72
// ### HSL
72
- _hue, _saturation, _lightness, _complement,
73
+ _hue.withDeprecationWarning ('color' ),
74
+ _saturation.withDeprecationWarning ('color' ),
75
+ _lightness.withDeprecationWarning ('color' ),
76
+ _complement.withDeprecationWarning ('color' ),
73
77
74
78
BuiltInCallable .overloadedFunction ("hsl" , {
75
79
r"$hue, $saturation, $lightness, $alpha" : (arguments) =>
@@ -116,7 +120,7 @@ final global = UnmodifiableListView([
116
120
// Use the native CSS `grayscale` filter function.
117
121
return _functionString ('grayscale' , arguments);
118
122
}
119
-
123
+ warnForGlobalBuiltIn ( 'color' , 'grayscale' );
120
124
var color = arguments[0 ].assertColor ("color" );
121
125
return color.changeHsl (saturation: 0 );
122
126
}),
@@ -125,23 +129,23 @@ final global = UnmodifiableListView([
125
129
var color = arguments[0 ].assertColor ("color" );
126
130
var degrees = _angleValue (arguments[1 ], "degrees" );
127
131
return color.changeHsl (hue: color.hue + degrees);
128
- }),
132
+ }). withDeprecationWarning ( 'color' , 'adjust' ) ,
129
133
130
134
_function ("lighten" , r"$color, $amount" , (arguments) {
131
135
var color = arguments[0 ].assertColor ("color" );
132
136
var amount = arguments[1 ].assertNumber ("amount" );
133
137
return color.changeHsl (
134
138
lightness: (color.lightness + amount.valueInRange (0 , 100 , "amount" ))
135
139
.clamp (0 , 100 ));
136
- }),
140
+ }). withDeprecationWarning ( 'color' , 'adjust' ) ,
137
141
138
142
_function ("darken" , r"$color, $amount" , (arguments) {
139
143
var color = arguments[0 ].assertColor ("color" );
140
144
var amount = arguments[1 ].assertNumber ("amount" );
141
145
return color.changeHsl (
142
146
lightness: (color.lightness - amount.valueInRange (0 , 100 , "amount" ))
143
147
.clamp (0 , 100 ));
144
- }),
148
+ }). withDeprecationWarning ( 'color' , 'adjust' ) ,
145
149
146
150
BuiltInCallable .overloadedFunction ("saturate" , {
147
151
r"$amount" : (arguments) {
@@ -153,6 +157,7 @@ final global = UnmodifiableListView([
153
157
return SassString ("saturate(${number .toCssString ()})" , quotes: false );
154
158
},
155
159
r"$color, $amount" : (arguments) {
160
+ warnForGlobalBuiltIn ('color' , 'adjust' );
156
161
var color = arguments[0 ].assertColor ("color" );
157
162
var amount = arguments[1 ].assertNumber ("amount" );
158
163
return color.changeHsl (
@@ -167,13 +172,17 @@ final global = UnmodifiableListView([
167
172
return color.changeHsl (
168
173
saturation: (color.saturation - amount.valueInRange (0 , 100 , "amount" ))
169
174
.clamp (0 , 100 ));
170
- }),
175
+ }). withDeprecationWarning ( 'color' , 'adjust' ) ,
171
176
172
177
// ### Opacity
173
- _function ("opacify" , r"$color, $amount" , _opacify),
174
- _function ("fade-in" , r"$color, $amount" , _opacify),
175
- _function ("transparentize" , r"$color, $amount" , _transparentize),
176
- _function ("fade-out" , r"$color, $amount" , _transparentize),
178
+ _function ("opacify" , r"$color, $amount" , _opacify)
179
+ .withDeprecationWarning ('color' , 'adjust' ),
180
+ _function ("fade-in" , r"$color, $amount" , _opacify)
181
+ .withDeprecationWarning ('color' , 'adjust' ),
182
+ _function ("transparentize" , r"$color, $amount" , _transparentize)
183
+ .withDeprecationWarning ('color' , 'adjust' ),
184
+ _function ("fade-out" , r"$color, $amount" , _transparentize)
185
+ .withDeprecationWarning ('color' , 'adjust' ),
177
186
178
187
BuiltInCallable .overloadedFunction ("alpha" , {
179
188
r"$color" : (arguments) {
@@ -185,6 +194,7 @@ final global = UnmodifiableListView([
185
194
return _functionString ("alpha" , arguments);
186
195
}
187
196
197
+ warnForGlobalBuiltIn ('color' , 'alpha' );
188
198
var color = argument.assertColor ("color" );
189
199
return SassNumber (color.alpha);
190
200
},
@@ -215,15 +225,16 @@ final global = UnmodifiableListView([
215
225
return _functionString ("opacity" , arguments);
216
226
}
217
227
228
+ warnForGlobalBuiltIn ('color' , 'opacity' );
218
229
var color = arguments[0 ].assertColor ("color" );
219
230
return SassNumber (color.alpha);
220
231
}),
221
232
222
233
// ### Miscellaneous
223
234
_ieHexStr,
224
- _adjust.withName ("adjust-color" ),
225
- _scale.withName ("scale-color" ),
226
- _change.withName ("change-color" )
235
+ _adjust.withDeprecationWarning ( 'color' ). withName ("adjust-color" ),
236
+ _scale.withDeprecationWarning ( 'color' ). withName ("scale-color" ),
237
+ _change.withDeprecationWarning ( 'color' ). withName ("change-color" )
227
238
]);
228
239
229
240
/// The Sass color module.
0 commit comments