Last active
January 5, 2018 13:13
-
-
Save laphilosophia/dfe8cfc0076355cad36f to your computer and use it in GitHub Desktop.
Color Palettes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.colors { | |
background-color: #153e78; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
@function remove-nth($list, $index) { | |
$result: null; | |
@if type-of($index) != number { | |
@warn "$index: #{quote($index)} is not a number for `remove-nth`."; | |
} | |
@else if $index == 0 { | |
@warn "List index 0 must be a non-zero integer for `remove-nth`."; | |
} | |
@else if abs($index) > length($list) { | |
@warn "List index is #{$index} but list is only #{length($list)} item long for `remove-nth`."; | |
} | |
@else { | |
$result: (); | |
$index: if($index < 0, length($list) + $index + 1, $index); | |
@for $i from 1 through length($list) { | |
@if $i != $index { | |
$result: append($result, nth($list, $i)); | |
} | |
} | |
} | |
@return $result; | |
} | |
@function val($map, $keys...) { | |
@if nth($keys, 1) == null { | |
$keys: remove-nth($keys, 1); | |
} | |
@each $key in $keys { | |
$map: map-get($map, $key); | |
} | |
@return $map; | |
} | |
@function _palette($keys...) { | |
@return val($palette, $keys...); | |
} | |
$palette: ( | |
primary-color: #153e78, | |
secondary-color: #37bb78, | |
third-color: #9013fe, | |
fourth-color: #72d3d5, | |
fifth-color: #ffc21f, | |
sixth-color: #f36e35, | |
default-black: #000000, | |
default-white: #ffffff | |
); | |
.colors { | |
background-color: _palette(primary-color); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment