module Term::ANSIColor::RGBColorMetricsHelpers::NormalizeRGBTriple

Private Instance Methods

normalize(v) click to toggle source
# File lib/term/ansicolor/rgb_color_metrics.rb, line 17
def normalize(v)
  v /= 255.0
  if v <= 0.04045
    v / 12
  else
    ( (v + 0.055) / 1.055 ) ** 2.4
  end
end
normalize_rgb_triple(rgb_triple) click to toggle source
# File lib/term/ansicolor/rgb_color_metrics.rb, line 26
def normalize_rgb_triple(rgb_triple)
  [
    normalize(rgb_triple.red),
    normalize(rgb_triple.green),
    normalize(rgb_triple.blue),
  ]
end