question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove color math

See original GitHub issue

Sass’s support for mathematical operations on RGB colors is misleading and not very useful. Channel-by-channel arithmetic is very difficult to use effectively when trying to produce a given human-comprehensible color transformation, and in all cases the color functions are better suited to the job.

We should begin by emitting a deprecation warning whenever a binary operation is performed for the +, *, -, /, or % operators when one of the operands is a color and the other is either a color or a number. Once the deprecation period is up, we should make all previously-deprecated operations emit errors.

It would be more consistent with the behavior of +, -, and / on other types to have them emit strings for colors once the deprecation period is over. Nevertheless, I think erroring out is the right thing to do. It makes it clearer that something’s going wrong for anyone who didn’t see the deprecation warnings, and I don’t think there are any real use-cases for using those operators in a stringifying way.

Tasks:

  • Deprecate existing behavior in stable.
  • Remove behavior from master.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:11
  • Comments:8

github_iconTop GitHub Comments

24reactions
justablobcommented, Jan 12, 2019

I’d like to dispute this change, if that is possible. As i’ve mentioned in my previous comment, i’d argue that color arithmetic does make sense and that it can reduce code footprint drastically. There was no reason for the removal of this feature, as i’d call it. My team has complained about having to change hundreds of lines of code only because a well-welcome feature was removed because some one thought it wouldn’t make sense.

3reactions
justablobcommented, Oct 26, 2018

I disagree with the reasons OP has given. While #fff - 10% might not look like it could make sense to anyone, it is quite obvious that it darkens it by 10%. It is much easier to type that than darken(#fff, 10%). I think the feature should be depreciated, however i’d like some way to enable it for those who actually use it. We want to make styling apps easier and faster after all, right? I hope this is reconsidered to some extent, it would really cheer up my dev team and me.

My 2 cents.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Pixel Math to remove primary color splotches - PixInsight
I'm wanting to look at a pixel and identify if it's mostly one color with low values of the other two colors.
Read more >
Removing all balls of one or more colors from an urn ...
I've started by thinking about this problem with two colors, red and green, and no mixed color balls. What is the probability of...
Read more >
Four color theorem - Wikipedia
In mathematics, the four color theorem, or the four color map theorem, states that no more than four colors are required to color...
Read more >
Apply or remove cell shading - Microsoft Support
Remove cell shading ... On the Home tab, in the Font group, click the arrow next to Fill Color, and then click No...
Read more >
Math 6: Subtracting Integers Using Two Color Counters
This video discusses how to subtract integers using two- color counters.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found