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

Version Path
term-ansicolor-1.8.0 bin/term_colortab
term-ansicolor-1.7.2 bin/term_colortab
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/term-ansicolor-1.7.1/bin/term_colortab
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/term-ansicolor-1.7.1/bin/term_colortab