module Term::ANSIColor::RGBColorMetrics::CompuPhase
Implements color distance as given in:
http://www.compuphase.com/cmetric.htm
Public Class Methods
distance(rgb1, rgb2)
click to toggle source
# File lib/term/ansicolor/rgb_color_metrics.rb, line 68 def self.distance(rgb1, rgb2) rmean = (rgb1.red + rgb2.red) / 2 rgb1.weighted_euclidean_distance_to rgb2, [ 2 + (rmean >> 8), 4, 2 + ((255 - rmean) >> 8) ] end