Skip to content

Named colours don't work as map keys #652

@mikeebee

Description

@mikeebee

Hi all,

I'm trying to implement a colour palette function seen in this article here.

http://erskinedesign.com/blog/friendlier-colour-names-sass-maps/

This is the resulting code

// config
$_color-base-grey: rgb(229,231,234);
$palettes: (
    purple: (
        base:   rgb(42,40,80),
        light:  rgb(51,46,140),
        dark:   rgb(40,38,65)
    ),
    grey: (
        base:  $_color-base-grey,
        light: lighten($_color-base-grey, 10%),
        dark: darken($_color-base-grey, 10%)
    )
);

// Palette function,
@function palette($palette, $tone: 'base') {
    @return map-get(map-get($palettes, $palette), $tone);
}


// in module styles
a {
    color: palette(purple);
    &:hover {
        color: palette(purple, light);
    }
}

All signs seem to point to this working but I get this error.

Warning: /Users/xxx/xxx//styles.scss:35: argument `$map` of `map-get($map, $key)` must be a map

I'm using Grunt Sass version - 0.16.1

Any ideas?

Many thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions