class Term::ANSIColor::HSLTriple

def self.[](thing)

def self.[](thing)
  case
  when thing.respond_to?(:to_hsl_triple) then thing.to_hsl_triple
  when thing.respond_to?(:to_hash)       then from_hash(thing.to_hash)
  when thing.respond_to?(:to_str)
    thing = thing.to_str
    from_css(thing.to_str) ||
      Term::ANSIColor::RGBTriple.from_html(thing).full?(:to_hsl_triple) ||
      Term::ANSIColor::RGBTriple.from_css(thing).full?(:to_hsl_triple)
  else raise ArgumentError, "cannot convert #{thing.inspect} into #{self}"
  end
end