colors

functions

cmyk

@function cmyk($cyan, $magenta, $yellow, $key: 0) { ... }

Description

Convert CMYK to RGB

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$cyan

0 to 1

Numbernone
$magenta

0 to 1

Numbernone
$yellow

0 to 1

Numbernone
$key

0 to 1

Number0

Returns

Color

Example

cmyk(0, 1, 1, 0)
// #f00

Throws

  • All parameters must be a unitless number

Requires

hsv

@function hsv($hue, $saturation, $value) { ... }

Description

Convert HSV to RGB

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$hue

0 to 360

Numbernone
$saturation

0% to 100%

Numbernone
$value

0% to 100%

Numbernone

Returns

Color

Example

hsv(240, 100%, 100%)
// #00f

Requires

random-color

@function random-color() { ... }

Description

Return a random color

Parameters

None.

Returns

Color

shade

@function shade($color, $percent) { ... }

Description

Darken a color

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$colornoneColornone
$percent

0% to 100%

Numbernone

Returns

Color

Example

shade(#fff, 40%)
// #999

tint

@function tint($color, $percent) { ... }

Description

Lighten a color

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$colornoneColornone
$percent

0% to 100%

Numbernone

Returns

Color

Example

tint(#000, 40%)
// #666

lists

functions

contains

@function contains($list, $value) { ... }

Description

Returns true if the value is present in the list.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$listnoneListnone
$valuenoneAnythingnone

Returns

Boolean

Example

contains(('a', 'b', 'c'), 'b')
// true

Used by

TODO's

  • Add optional recursive search

each

@function each($list, $function, $args...) { ... }

Description

Creates a new list with the results of calling a provided function on every element in this list.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$listnoneListnone
$functionnoneStringnone
$args...noneArgumentsnone

Returns

List

Example

$list: ('a', 'b', 'c');
each($list, 'str-insert', 'x', 1)
// ('xa', 'xb', 'xc')

Throws

  • #{$list} is not a list

  • Function #{$function}() does not exist!

Used by

str-join

@function str-join($list, $separator: ',') { ... }

Description

Join all items of a list into a string

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$listnoneListnone
$separatornoneString','

Returns

String

Example

$list: ('a', 'b', 'c', 'd');
str-join($list, '+')
// a+b+c+d

Used by

without

@function without($list, $values...) { ... }

Description

Returns a copy of a list with values removed

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$listnoneListnone
$values...noneAnythingnone

Returns

List

Example

$list: ('a', 'b', 'c', 'd');
without($list, 'b', 'a')
// ('c', 'd')

Used by

compact

@function compact($list) { ... }

Description

Returns a copy of a list with falsy values removed ('' and false)

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$listnoneListnone

Returns

List

Example

$list: ('a', 'b', '', 'c', false, 'd');
compact($list)
// ('a', 'b', 'c', 'd')

Requires

numbers

functions

add-unit

@function add-unit($number, $unit) { ... }

Description

Add unit to a number

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$numbernoneNumbernone
$unitnoneStringnone

Returns

Number

Example

add-unit(1, 'px')
// 1px

Throws

  • $number must be unitless

Used by

polar-to-cartesian

@function polar-to-cartesian($distance, $angle) { ... }

Description

Return cartesian coordinates

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$distancenoneNumbernone
$anglenoneNumbernone

Returns

List

Example

polar-to-cartesian(5px, 90deg)
// 0 5px

Throws

Requires

  • [function] strip-unit
  • [function] add-unit
  • [external] Math::deg-to-rad
  • [external] Math::cos
  • [external] Math::sin

Used by

Links

coordinates

@function coordinates($distance, $angle) { ... }

Description

Return cartesian coordinates in CSS-format (by inverting the Y-axis)

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$distancenoneNumbernone
$anglenoneNumbernone

Returns

List

Example

coordinates(5px, 90deg)
// 0 -5px

Requires

inverse

@function inverse($number) { ... }

Description

Invert the sign of a number

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$numbernoneNumbernone

Returns

Number

Example

inverse(3px)
// -3px

Throws

  • #{$numbers} NaN

Used by

replace-unit

@function replace-unit($number, $unit) { ... }

Description

Replace unit with another unit

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$numbernoneNumbernone
$unitnoneStringnone

Returns

Number

Example

replace-unit(1px, 'em')
// 1em

Requires

strip-unit

@function strip-unit($number) { ... }

Description

Remove the unit of a number

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$numbernoneNumbernone

Returns

Number

Example

strip-unit(1px)
// 1

Used by

Author

  • Jason Nickel

settings

variables

[private] sg-version

$sg-version: '4.0.0';

Description

The App version

Type

String

sunglass

$sunglass: () !default;

Description

Global settings map

Type

Map

[private] sg-settings

$sg-settings: ();

Description

Private settings map

Type

Map

valid-units

$valid-units: (
  'em': 0em,
  'ex': 0ex,
  'ch': 0ch,
  'rem': 0rem,
  'vh': 0vh,
  'vw': 0vw,
  'vmin': 0vmin,
  'vmax': 0vmax,
  'px': 0px,
  'mm': 0mm,
  'cm': 0cm,
  'in': 0in,
  'pt': 0pt,
  'pc': 0pc,
  '%': 0%,
  'deg': 0deg,
  'grad': 0grad,
  'rad': 0rad,
  'turn': 0turn,
  'Hz': 0Hz,
  'kHz': 0kHz,
  'dpi': 0dpi,
  'dpcm': 0dpcm,
  'dppx': 0dppx,
  's': 0s,
  'ms': 0ms
);

Description

Global units map

Type

Map

strings

functions

str-concat

@function str-concat($strings...) { ... }

Description

Combines the text of two or more strings and returns a new string.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$strings...noneStringsnone

Returns

Boolean

Example

str-concat('a', 'b', 'c')
// abc

Requires

str-contains

@function str-contains($string, $substr, $start: 0) { ... }

Description

Returns true if the value is present in the string.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$stringnoneStringnone
$substrnoneStringnone
$startnoneNumber0

Returns

Boolean

Example

str-contains('abc', 'b')
// true

TODO's

  • Add optional recursive search

str-count

@function str-count($string, $substr) { ... }

Description

Returns the number of substrings in the string.

Parameters

parameterNameparameterDescriptionparameterTypeparameterDefault value
$stringnoneStringnone
$substrnoneStringnone

Returns

Number

Example

str-count('abcabc', 'b')
// 2