### Home Classes Methods

### In Files

- lib/term/ansicolor/rgb_color_metrics.rb

### Parent

Struct.new(:y, :u, :v)

### Methods

- ::from_rgb_triple

### Included Modules

- Term::ANSIColor::RGBColorMetricsHelpers::WeightedEuclideanDistance

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Term
- Term::ANSIColor
- Term::ANSIColor::Attribute
- Term::ANSIColor::PPMReader
- Term::ANSIColor::RGBColorMetrics
- Term::ANSIColor::RGBColorMetrics::CIELab
- Term::ANSIColor::RGBColorMetrics::CIELab::CIELabTriple
- Term::ANSIColor::RGBColorMetrics::CIEXYZ
- Term::ANSIColor::RGBColorMetrics::CIEXYZ::CIEXYZTriple
- Term::ANSIColor::RGBColorMetrics::CompuPhase
- Term::ANSIColor::RGBColorMetrics::Euclidean
- Term::ANSIColor::RGBColorMetrics::NTSC
- Term::ANSIColor::RGBColorMetrics::YUV
- Term::ANSIColor::RGBColorMetrics::YUV::YUVTriple
- Term::ANSIColor::RGBColorMetricsHelpers
- Term::ANSIColor::RGBColorMetricsHelpers::NormalizeRGBTriple
- Term::ANSIColor::RGBColorMetricsHelpers::WeightedEuclideanDistance
- Term::ANSIColor::RGBTriple

No matching classes.

# Term::ANSIColor::RGBColorMetrics::YUV::YUVTriple

### Public Class Methods

from_rgb_triple(rgb_triple) click to toggle source

    # File lib/term/ansicolor/rgb_color_metrics.rb, line 79
    def self.from_rgb_triple(rgb_triple)
      r, g, b = rgb_triple.red, rgb_triple.green, rgb_triple.blue
      y = (0.299 * r + 0.587 * g + 0.114 * b).round
      u = ((b - y) * 0.492).round
      v = ((r - y) * 0.877).round
      new(y, u, v)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.