Module: Sass::Extras::YUV::Color

Defined in:
lib/sass/extras/yuv.rb

Instance Method Summary collapse

Instance Method Details

#yuvObject



12
13
14
15
16
17
18
19
# File 'lib/sass/extras/yuv.rb', line 12

def yuv
  r, g, b = rgb.map { |k| k / 255.0 }
  y = r * WR + g * WG + b * WB
  y = 1.0 if y == W_SUM
  u = U_MAX * (b - y) / (1 - WB)
  v = V_MAX * (r - y) / (1 - WR)
  [y, Utils.restrict(u, -U_MAX..U_MAX), Utils.restrict(v, -V_MAX..V_MAX)]
end

#yuvaObject



21
22
23
# File 'lib/sass/extras/yuv.rb', line 21

def yuva
  yuv + [alpha]
end