Skip to content

Remove color math #2144

@nex3

Description

@nex3

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions