Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion for reducing redundancy and arriving toward pure JSON #4

Open
aaronshaf opened this issue Aug 29, 2019 · 0 comments
Open

Comments

@aaronshaf
Copy link

aaronshaf commented Aug 29, 2019

Consider the following example:

colors: {
  blue: '#07c',
  blues: [
    '#004170',
    '#006fbe',
    '#2d8fd5',
    '#5aa7de',
  ]
}

One then has to then assign color names:

theme.colors.blues.regalBlue = theme.colors.blues[0]

But because object literals in JSON and JavaScript are already ordered, one could perhaps use instead:

colors: {
  blue: '#07c',
  blues: {
    regalBlue: '#004170',
    lochmara: '#006fbe',
    curiousBlue: '#2d8fd5',
    havelockBlue: '#5aa7de',
  }
}

Something like styled-system could then transform blues to be available as an array, e.g. blues[0] or blues.0. Keys in JavaScript are already ordered.

It'd be perhaps nice if theme objects could be in JSON? Then we could use a JSON schema to validate theme objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant