Sha256: 129910d53b54d173a3553522cac9d823204b754f3665b1a59ba01da77d64e4df

Contents?: true

Size: 780 Bytes

Versions: 4

Compression:

Stored size: 780 Bytes

Contents

#!/usr/bin/env ruby
require_relative '../../lib/vedeu/output/colour_translator'

values = ["00", "5f", "87", "af", "d7", "ff"]
codes  = {}

values.each do |r|
  values.each do |g|
    values.each do |b|
      value = ["#", r, g, b].join
      trans = Vedeu::ColourTranslator.translate(value)
      codes[trans] = value
    end
  end
end

# basic
30.upto(38) do |fg|
  40.upto(48) do |bg|
    print "\e[38;2;#{fg}m\e[48;2;#{bg}mVedeu\e[0m"
  end
  print "\n"
end

# foreground
codes.each_slice(6) do |c|
  c.each do |k, v|
    printf "\e[48;2;49m \e[38;5;%s30m%s %3s ", k, v, k
  end
  print "\e[48;2;49m\e[38;2;39m\n"
end

# background
codes.each_slice(6) do |c|
  c.each do |k, v|
    printf "\e[48;5;%sm \e[38;2;30m%s %3s ", k, v, k
  end
  print "\e[48;2;49m\e[38;2;39m\n"
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.1.7 test/support/colours.rb
vedeu-0.1.6 test/support/colours.rb
vedeu-0.1.5 test/support/colours.rb
vedeu-0.1.4 test/support/colours.rb