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

Make core plugins that depend on colors fall back to global color palette if not specified explicitly #639

Closed
wants to merge 7 commits into
base: config-restructuring
from

Conversation

Projects
None yet
1 participant
@adamwathan
Copy link
Member

adamwathan commented Feb 2, 2019

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

This comment has been minimized.

Copy link
Member Author

adamwathan commented Feb 6, 2019

Closing in favor of #645.

@adamwathan adamwathan closed this Feb 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment