Skip to content

Conversation

@adamwathan
Copy link
Member

PRing this against config-restructuring to make the diff cleaner for now, but ultimately will be targeting the next branch once config-restructuring is merged.

This PR makes it so that changes to the colors object in the theme section of your config file are automatically inherited by the backgroundColors, borderColors, and textColors core plugins.

This means that instead of having to do this:

module.exports = {
  theme: {
    colors: {
      ...defaultTheme.colors,
      customColor: '#bada55',
    },
    backgroundColors: {
      ...defaultTheme.colors,
      customColor: '#bada55',
    },
    borderColors: {
      ...defaultTheme.colors,
      customColor: '#bada55',
    },
    textColors: {
      ...defaultTheme.colors,
      customColor: '#bada55',
    },
  },
}

...or this:

const colors = {
  ...defaultTheme.colors,
  customColor: '#bada55',
}

module.exports = {
  theme: {
    colors: colors,
    backgroundColors: colors,
    borderColors: colors,
    textColors: colors,
  },
}

...you can just do this:

module.exports = {
  theme: {
    colors: {
      ...defaultTheme.colors,
      customColor: '#bada55',
    },
  },
}

I still need to figure out a solution for the borderColors.default thing, because to make this PR work properly I also need to delete the backgroundColors, borderColors, and textColors sections from the default theme. Won't merge until I have that figured out.

@adamwathan adamwathan changed the title Core plugins that depend on colors fall back to global color palette if not specified explicitly Make core plugins that depend on colors fall back to global color palette if not specified explicitly Feb 2, 2019
@adamwathan
Copy link
Member Author

Closing in favor of #645.

@adamwathan adamwathan closed this Feb 6, 2019
@adamwathan adamwathan deleted the color-fallbacks branch May 13, 2019 14:01
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

Successfully merging this pull request may close these issues.

2 participants