Sha256: a67796fb6f964934592b0795f9512bac55c838c3d66205cdfa7c2f20bf9c0bff
Contents?: true
Size: 761 Bytes
Versions: 29
Compression:
Stored size: 761 Bytes
Contents
#!/usr/bin/env ruby require 'term/ansicolor' class String include Term::ANSIColor end def print_color(c) color = Term::ANSIColor::Attribute[c] text = [ Term::ANSIColor::Attribute.nearest_rgb_color('#000'), Term::ANSIColor::Attribute.nearest_rgb_color('#fff'), ].max_by { |t| t.distance_to(color) } print ("%3u #{color.rgb.html} " % c).on_color(color.name).color(text.name) end for c in 0..3 print_color c end puts for c in 4..7 print_color c end puts puts for c in 8..11 print_color c end puts for c in 12..15 print_color c end for c in 16..231 (c - 16) % 6 == 0 and puts (c - 16) % 36 == 0 and puts print_color c end for c in 232..255 (c - 16) % 6 == 0 and puts (c - 16) % 12 == 0 and puts print_color c end puts
Version data entries
29 entries across 20 versions & 2 rubygems