map_get

map_get($map, $key) Returns the value in a map associated with the given key. If the map doesn’t have such a key, returns null. Examples: map-get(("foo": 1, "bar": 2), "foo") => 1 map-get(("foo": 1, "bar": 2), "bar") => 2 map-get(("foo": 1, "bar": 2), "baz") => null Parameters: $map (Map) $key (Base) Returns: (Base) — The value indexed by $key, or null if the map doesn’t contain the given key Raises: (ArgumentError) — if $map is not a map

lightness

lightness($color) Returns the lightness component of a color. See the CSS3 HSL specification. Calculated from RGB where necessary via this algorithm. Parameters: $color (Color) Returns: (Number) — The lightness component, between 0% and 100% Raises: (ArgumentError) — if $color isn’t a color

keywords

keywords($args) Returns the map of named arguments passed to a function or mixin that takes a variable argument list. The argument names are strings, and they do not contain the leading $. Examples: @mixin foo($args...) { @debug keywords($args); //=> (arg1: val, arg2: val) } @include foo($arg1: val, $arg2: val); Parameters: $args (ArgList) Returns: (Map) Raises: (ArgumentError) — if $args isn’t a variable argument list

length

length($list) Return the length of a list. This can return the number of pairs in a map as well. Examples: length(10px) => 1 length(10px 20px 30px) => 3 length((width: 10px, height: 20px)) => 2 Parameters: $list (Base) Returns: (Number)

join

join($list1, $list2, $separator:auto) Joins together two lists into one. Unless $separator is passed, if one list is comma-separated and one is space-separated, the first parameter’s separator is used for the resulting list. If both lists have fewer than two items, spaces are used for the resulting list. Like all list functions, join() returns a new list rather than modifying its arguments in place. Examples: join(10px 20px, 30px 40px) => 10px 20px 30px 40px join((blue, red), (#abc, #def

Interactive shell

Interactive Shell You can easily experiment with SassScript using the interactive shell. To launch the shell run the sass command-line with the -i option. At the prompt, enter any legal SassScript expression to have it evaluated and the result printed out for you: $ sass -i >> "Hello, Sassy World!" "Hello, Sassy World!" >> 1px + 1px + 1px 3px >> #777 + #777 #eeeeee >> #777 + #888 white

invert

invert($color) Returns the inverse (negative) of a color. The red, green, and blue values are inverted, while the opacity is left alone. Parameters: $color (Color) Returns: (Color) Raises: (ArgumentError) — if $color isn’t a color

is_superselector

is_superselector($super, $sub) Returns whether $super is a superselector of $sub. This means that $super matches all the elements that $sub matches, as well as possibly additional elements. In general, simpler selectors tend to be superselectors of more complex oned. Examples: is-superselector(".foo", ".foo.bar") => true is-superselector(".foo.bar", ".foo") => false is-superselector(".bar", ".foo .bar") => true is-superselector(".foo .bar", ".bar") => false Returns Whether $s

inspect

inspect($value) Return a string containing the value as its Sass representation. Parameters: $value (Base) — The value to inspect. Returns: (String) — A representation of the value as it would be written in Sass.

index

index($list, $value) Returns the position of a value within a list. If the value isn’t found, returns null instead. Note that unlike some languages, the first item in a Sass list is number 1, the second number 2, and so forth. This can return the position of a pair in a map as well. Examples: index(1px solid red, solid) => 2 index(1px solid red, dashed) => null index((width: 10px, height: 20px), (height 20px)) => 2 Parameters: $list (Base) $value (Base) Returns: (Number