Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Modular CSS with Sass Getting Modular with Mixins and Functions Nested Sass Maps

Brad Lacke
Brad Lacke
7,438 Points

Sass Error with color maps

I'm getting:

  error scss/_base.scss (Line 26: $map: ((grey: (xx-light: #ebecec, x-light: #d6d7d9, light: #999da1, base: #797e83, dark: #656a6e, x-dark: #525559), black: (light: #252525, base: #0b0b0b, dark: black)), #808080) is not a map for `map-get')

Here's my color map - it looks identical to me to the one in Guil's video.

// Color Palette Modifiers

$palettes: (
    grey: (
        xx-light   : lighten($grey, 43%),
        x-light    : lighten($grey, 35%),
        light      : lighten($grey, 12%),
        base       : $grey,
        dark       : darken($grey, 8%),
        x-dark     : darken($grey, 16%),
    ),
    black: (
        light      : lighten($black, 10%),
        base       : $black,
        dark       : darken($black, 10%),
    )
);

and here's the function called in the _base.scss partial:

    color: map-get(($palettes, grey), x-dark);

under the h1 rule. Can anyone see what I'm doing wrong? Driving me nuts.

2 Answers

Colin Marshall
Colin Marshall
32,861 Points

You have to have map-get twice so that it goes two levels down inside your palettes variable. Like this:

color: map-get(map-get($palettes, grey), x-dark);
Brad Lacke
Brad Lacke
7,438 Points

Totally overlooked that. Thank you!