shuhei / material-colors

Colors of Google's Material Design made available to coders
https://shuheikagawa.com/material-colors/
ISC License
270 stars 41 forks source link

Cannot use dot-notation in javascript #20

Open noseglid opened 7 years ago

noseglid commented 7 years ago

Using this via javascript (es6)

import { red } from 'material-colors';

const style = {
  color: red['500'] // <-- awkwardness here
};

500 cannot be retrieved via dot-notation (i.e. red.500 is not valid javascript).

I'd like to retrieve the primary color via dot-notation: red.primary. I think it only makes sense for the primary color (as named by google).

What do you think?

shuhei commented 7 years ago

I think names like 500 are good enough, but it's also a good idea to add aliases, primary and secondary, because I can imagine many people use only primary and secondary.