src/Utils/ColorTools.php
public static function visibleOver($color, $greyscale = false)
  {
    $color = static::toRGBA($color);
    if ($greyscale) {
      $median = 255 - ($color['red'] + $color['green'] + $color['blue']) / 3;
      return array(
        'red' => $median,
        'green' => $median,
        'blue' => $median
      );
    }
    return array(
      'red' => 255 - $color['red'],
      'green' => 255 - $color['green'],
      'blue' => 255 - $color['blue']
    );
  }
public static function visibleOver($color, $greyscale = false)
  {
    $color = static::toRGBA($color);
    if ($greyscale) {
      $median = 255 - ($color['red'] + $color['green'] + $color['blue']) / 3;
      return array(
        'red' => $median,
        'green' => $median,
        'blue' => $median
      );
    }
    return array(
      'red' => 255 - $color['red'],
      'green' => 255 - $color['green'],
      'blue' => 255 - $color['blue']
    );
  }
Return a visible color over another one (eg. #ffffee is not visible over #ffffff)

@param  mixed   $color     Background color
@param  boolean $greyscale Should output color be grey?
@return mixed              An [red, green, blue] associative array