]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Make access to $foundation-palette a bit easier 8911/head
authorDaniel Schuba <dasch@daschmedia.de>
Wed, 8 Jun 2016 12:58:59 +0000 (14:58 +0200)
committerDaniel Schuba <dasch@daschmedia.de>
Wed, 8 Jun 2016 12:58:59 +0000 (14:58 +0200)
Accessing colors from $foundation-palette through map-get needs a lot of code. This way it would be a lot easier to use colors from palette.

scss/util/_color.scss

index a001de2a2f65cb41717b8e54d1e749f3ce953f54..68561aa665d8fc4b3ef52348a95e48ca85b2f120 100644 (file)
   @return scale-color($color, $lightness: $scale);
 }
 
+/// Get color from foundation-palette
+///
+/// @param {key} color key from foundation-palette
+///
+/// @returns {Color} color from foundation-palette
+@function get-color($key) {
+  @if map-has-key($foundation-palette, $key) {
+    @return map-get($foundation-palette, $key);
+  } @else {
+    @error 'given $key is not available in $foundation-palette';
+  }
+}
+
 /// Transfers the colors in the `$foundation-palette` variable into the legacy color variables, such as `$primary-color` and `$secondary-color`. Call this mixin below the Global section of your settings file to properly migrate your codebase.
 @mixin add-foundation-colors() {
   @if map-has-key($foundation-palette, primary) {