Skip to content

feature / improving color-yiq function #26846

@wtorsi

Description

@wtorsi

Hi,
The function is very great (thanks), but it will be much more convenient if we add some arguments, like below.
What do you think?

@function color-yiq($color, $dark: $yiq-text-dark, $light: $yiq-text-light) {
  $r: red($color);
  $g: green($color);
  $b: blue($color);

  $yiq: (($r * 299) + ($g * 587) + ($b * 114)) / 1000;

  @if ($yiq >= $yiq-contrasted-threshold) {
	@return $dark;
  } @else {
	@return $light;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions