From 09ad12b99dc0ddf332c06a1acf763fa985051171 Mon Sep 17 00:00:00 2001 From: Daniel Schuba Date: Wed, 8 Jun 2016 14:58:59 +0200 Subject: [PATCH] Make access to $foundation-palette a bit easier 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 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scss/util/_color.scss b/scss/util/_color.scss index a001de2a2..68561aa66 100644 --- a/scss/util/_color.scss +++ b/scss/util/_color.scss @@ -40,6 +40,19 @@ @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) { -- 2.47.2