class Term::ANSIColor::RGBTriple

def self.[](thing)

def self.[](thing)
  case
  when thing.respond_to?(:to_rgb_triple) then thing.to_rgb_triple
  when thing.respond_to?(:to_ary)        then from_array(thing.to_ary)
  when thing.respond_to?(:to_str)
    thing = thing.to_str
    from_html(thing.sub(/\Aon_/, '')) || from_css(thing) ||
      Term::ANSIColor::HSLTriple.from_css(thing).full?(:to_rgb_triple)
  when thing.respond_to?(:to_hash)       then from_hash(thing.to_hash)
  else raise ArgumentError, "cannot convert #{thing.inspect} into #{self}"
  end
end