how to @each a map or something like it...

14 views
Skip to first unread message

Thiago Jaworski

unread,
Jul 6, 2016, 5:14:40 PM7/6/16
to Sass
(Sorry for the bad English)

So ...

i was building a fast style creator ... where i input a map of colors and respective names ... and it give me a full swatch variations list ... but i need this full list to be a map and i can't apply an @each function inside of a map ... someone have idea how to make it?

Ex.


//list of colors i want to iterate
$base-colors: (color-a, #333), (color-b, #aff), (color-c, #cc0);


//the each was suppose to do this...


$full
-color-list:
@each $color-slang, $color-code in $base-colors {
$color-slang: ($color-slang, $color-code), (#{$color-slang}-dark, darken($color-code, 20)), (#{$color-slang}-light, lighten($color-code, 20));
}

;

RESULT
$full-color-list: (
color-1: (color-1, #333), (color-1-dark, darken(#333, 20)), (color-1-light, lighten(#333, 20));
color-2: (color-2, #aff), (color-2-dark, darken(#aff, 20)), (color-2-light, lighten(#aff, 20));
color-3: (color-3, #cc0), (color-3-dark, darken(#cc0, 20)), (color-3-light, lighten(#cc0, 20));
)



Thanks.
Reply all
Reply to author
Forward
0 new messages