-
Notifications
You must be signed in to change notification settings - Fork 529
/
sass_functions.txt
executable file
·216 lines (147 loc) · 5.68 KB
/
sass_functions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!--
@Author: Anas Aboureada <anas>
@Date: Tue, 14th Mar 2017, T 15:29 +01:00
@Email: me@anasaboureada.com
@Project: awesome-full-stack-web-developer
@Filename: sass_functions.md
@Last modified by: anas
@Last modified time: Tue, 14th Mar 2017, T 15:34 +01:00
@License: MIT License
@Copyright: Copyright (c) 2017 Anas Aboureada <anasaboureada.com>
-->
## Sass Functions Cheat Sheet
1. [RGB Functions](#rgb-functions)
1. [HSL Functions](#hsl-functions)
1. [Opacity Functions](#opacity-functions)
1. [Other Color Functions](#other-color-functions)
1. [List Functions](#list-functions)
1. [Map Functions](#map-functions)
1. [Selector Functions](#selector-functions)
1. [String Functions](#string-functions)
1. [Number Functions](#number-functions)
1. [Introspection Functions](#introspection-functions)
1. [Miscellaneous Functions](#miscellaneous-functions)
#### RGB Functions
[**`rgb($red, $green, $blue)`**](http://sass-lang.com/documentation/Sass/Script/Functions.html#rgb-instance_method)
Creates a color from red, green, and blue values.
**`rgba($red, $green, $blue, $alpha)`**
Creates a color from red, green, blue, and alpha values.
**`red($color)`**
Gets the red component of a color.
**`green($color)`**
Gets the green component of a color.
**`blue($color)`**
Gets the blue component of a color.
**`mix($color1, $color2, [$weight])`**
Mixes two colors together.
==========
#### HSL Functions
**`hsl($hue, $saturation, $lightness)`**
Creates a color from hue, saturation, and lightness values.
**`hsla($hue, $saturation, $lightness, $alpha)`**
Creates a color from hue, saturation, lightness, and alpha values.
**`hue($color)`**
Gets the hue component of a color.
**`saturation($color)`**
Gets the saturation component of a color.
**`lightness($color)`**
Gets the lightness component of a color.
**`adjust-hue($color, $degrees)`**
Changes the hue of a color.
**`lighten($color, $amount)`**
Makes a color lighter.
**`darken($color, $amount)`**
Makes a color darker.
**`saturate($color, $amount)`**
Makes a color more saturated.
**`desaturate($color, $amount)`**
Makes a color less saturated.
**`grayscale($color)`**
Converts a color to grayscale.
**`complement($color)`**
Returns the complement of a color.
**`invert($color)`**
Returns the inverse of a color.
==========
#### Opacity Functions
**`alpha($color) / opacity($color)`**
Gets the alpha component (opacity) of a color.
**`rgba($color, $alpha)`**
Changes the alpha component for a color.
**`opacify($color, $amount) / fade-in($color, $amount)`**
Makes a color more opaque.
**`transparentize($color, $amount) / fade-out($color, $amount)`**
Makes a color more transparent.
==========
#### Other Color Functions
Visit [Sass Functions](http://sass-lang.com/documentation/Sass/Script/Functions.html).
==========
#### List Functions
Visit [Sass Functions](http://sass-lang.com/documentation/Sass/Script/Functions.html).
==========
#### Map Functions
Visit [Sass Functions](http://sass-lang.com/documentation/Sass/Script/Functions.html).
==========
#### Selector Functions
**`selector-nest($selectors...)`**
Nests selector beneath one another like they would be nested in the stylesheet.
**`selector-replace($selector, $original, $replacement)`**
Replaces `$original` with `$replacement` within `$selector`.
More at [Sass Functions](http://sass-lang.com/documentation/Sass/Script/Functions.html).
==========
#### String Functions
**`unquote($string)`**
Removes quotes from a string.
**`quote($string)`**
Adds quotes to a string.
**`str-length($string)`**
Returns the number of characters in a string.
More at [Sass Functions](http://sass-lang.com/documentation/Sass/Script/Functions.html).
==========
#### Number Functions
**`percentage($number)`**
Converts a unitless number to a percentage.
**`round($number)`**
Rounds a number to the nearest whole number.
**`ceil($number)`**
Rounds a number up to the next whole number.
**`floor($number)`**
Rounds a number down to the previous whole number.
**`abs($number)`**
Returns the absolute value of a number.
**`min($numbers...)`**
Finds the minimum of several numbers.
**`max($numbers...)`**
Finds the maximum of several numbers.
**`random([$limit])`**
Returns a random number.
==========
#### Introspection Functions
**`feature-exists($feature)`**
Returns whether a feature exists in the current Sass runtime.
**`variable-exists($name)`**
Returns whether a variable with the given name exists in the current scope.
**`global-variable-exists($name)`**
Returns whether a variable with the given name exists in the global scope.
**`function-exists($name)`**
Returns whether a function with the given name exists.
**`mixin-exists($name)`**
Returns whether a mixin with the given name exists.
**`inspect($value)`**
Returns the string representation of a value as it would be represented in Sass.
**`type-of($value)`**
Returns the type of a value.
**`unit($number)`**
Returns the unit(s) associated with a number.
**`unitless($number)`**
Returns whether a number has units.
**`comparable($number1, $number2)`**
Returns whether two numbers can be added, subtracted, or compared.
**`call($name, $args…)`**
Dynamically calls a Sass function.
==========
#### Miscellaneous Functions
**`if($condition, $if-true, $if-false)`**
Returns one of two values, depending on whether or not `$condition` is true.
**`unique-id()`**
Returns a unique CSS identifier.