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

Derive ‘-invert’ sass variables from primary colors (Fixes #706) #2594

Merged
merged 2 commits into from Oct 13, 2019

Conversation

WesselKuipers
Copy link
Contributor

This is a bugfix. Fixes #706.

Proposed solution

When overriding the primary color variables, the corresponding -invert variables do not get updated since these are derived from their parent's base color, like so: $primary: $turquoise, $primary-invert: $turquoise-invert.

Issues arise when attempting to override one of these variables with your own colors, since their corresponding -invert variable will still be based on its parent's base color instead of its parent.

Since the -invert variables are supposed to find an appropriate contrast to its parent color, I think it is better to derive it from its parent variable directly using findColorInvert().

Tradeoffs

This solution can impact any user that overrides variables such as $primary without also overriding its corresponding -invert variable, possibly causing some light text to become dark and vice versa.

Testing Done

Tested by setting $primary to #fff in derived-variables.sass and building the css, resulting in:

.button.is-primary {
  background-color: #fff;
  border-color: transparent;
  color: rgba(0, 0, 0, 0.7);
}

Compared to what it previously outputted when doing the same thing:

.button.is-primary {
  background-color: #fff;
  border-color: transparent;
  color: #fff;
}

Changelog updated?

Yes.

@jgthms jgthms merged commit f99771e into jgthms:master Oct 13, 2019
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.

Inverted primary color not updating
2 participants