Module: ColorContrastCalc::Utils::Hwb

Included in:
ColorContrastCalc::Utils
Defined in:
lib/color_contrast_calc/utils.rb

Instance Method Summary collapse

Instance Method Details

#hwb_to_rgb(hwb) ⇒ Object



258
259
260
261
262
263
264
265
# File 'lib/color_contrast_calc/utils.rb', line 258

def hwb_to_rgb(hwb)
  hue, white, black = normalize_hwb(hwb)
  rgb = Utils.hsl_to_rgb([hue, 100, 50])

  rgb.map do |c|
    ((c * (1.0 - white - black)) + white * 255).round
  end
end

#rgb_to_hwb(_rgb) ⇒ Object

Raises:

  • (Notimplementederror)


267
268
269
# File 'lib/color_contrast_calc/utils.rb', line 267

def rgb_to_hwb(_rgb)
  raise Notimplementederror, 'Must be implemented later'
end