### Home Classes Methods

### In Files

- lib/term/ansicolor/rgb_color_metrics.rb

### Parent

Struct.new(:x, :y, :z)

### 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::CIEXYZ::CIEXYZTriple

### Public Class Methods

from_rgb_triple(rgb_triple) click to toggle source

    # File lib/term/ansicolor/rgb_color_metrics.rb, line 100
    def self.from_rgb_triple(rgb_triple)
      r, g, b = normalize_rgb_triple rgb_triple

      x =  0.436052025 * r + 0.385081593 * g + 0.143087414 * b
      y =  0.222491598 * r + 0.71688606  * g + 0.060621486 * b
      z =  0.013929122 * r + 0.097097002 * g + 0.71418547  * b

      x *= 255
      y *= 255
      z *= 255

      new(x.round, y.round, z.round)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.