/** * Returns the luma * * @return integer */ public function getLuma() { if ($this->luma !== null) { return $this->luma; } // Y = 0.2126 R + 0.7152 G + 0.0722 B $r = ILess_Math::multiply('0.2126', ILess_Math::divide($this->rgb[0], 255)); $g = ILess_Math::multiply('0.7152', ILess_Math::divide($this->rgb[1], 255)); $b = ILess_Math::multiply('0.0722', ILess_Math::divide($this->rgb[2], 255)); $this->luma = ILess_Math::add(ILess_Math::add($r, $g), $b); return $this->luma; }