Color function optimization #4088

Open
wants to merge 3 commits into
from

Projects

None yet

4 participants

@TheGrimSilence

Changes

  • Optimized color() in _color.scss
  • Removed unneeded quotations across $colors map and all calls to color()
  • Combined color and shade class functions
@developeranirudhprabhu
Contributor

@acburst and @Dogfalo can you please look into it?

@acburst
Collaborator
acburst commented Jan 11, 2017

You got rid of our warning for an incorrect color input. Have you tested input errors?

@TheGrimSilence

Given that the colors are highly based on Google's color pallet the chance of 'new' and or 'changed' colors are low. But, if you feel cautious it can be added. Warnings are easy to avoid as long as you know what you're doing.

@Dogfalo
Owner
Dogfalo commented Jan 11, 2017

It helps people debug if they have a typo in the color function

@TheGrimSilence

Warning added back, code is safe.

@acburst
Collaborator
acburst commented Jan 11, 2017

That part of the code will never be executed? That was why we checked beforehand if the key existed so we could correctly return null with a warning. Right now it will only return null.

@TheGrimSilence
TheGrimSilence commented Jan 11, 2017 edited

If there's a typo, it'll give a warning. The warning is as you originally typed it. Code runs fine. Same functionality.

@acburst
Collaborator
acburst commented Jan 12, 2017

I've just tested this with 3 cases:

color(xxx, base);

Which results in a compilation error.

color(xxx);

Which compiles, but does not raise the warning (which it should).

color(teal, xxx);

Which compiles, but does not raise the warning (which it should).

@TheGrimSilence

Hm. I'll fix it
.

@TheGrimSilence

Warning didn't work because I forgot to add the parent @if map-has-key($colors, $color)

@developeranirudhprabhu
Contributor

@acburst @Dogfalo Please look into it and do the needful

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