Module: RubyRaider::Logo
- Defined in:
- lib/utilities/logo.rb
Overview
Displays the Ruby Raider logo as colored pixel art in the terminal. Renders a faceted gem icon alongside “RUBY RAIDER” in a pixel font, using Unicode half-block characters for compact, high-detail output.
Constant Summary collapse
- PALETTE =
Color palette: 0 = empty, 1 = dark, 2 = medium, 3 = bright
{ 1 => '130;30;48', 2 => '180;45;65', 3 => '230;70;90' }.freeze
- GEM =
Gem diamond with faceted shading (6 pixel rows × 9 cols)
[ [0, 0, 0, 3, 3, 3, 0, 0, 0], [0, 2, 3, 3, 3, 3, 3, 2, 0], [2, 3, 2, 3, 3, 3, 2, 3, 2], [2, 2, 1, 2, 2, 2, 1, 2, 2], [0, 1, 2, 1, 1, 1, 2, 1, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0] ].freeze
- GLYPHS =
5-row pixel font glyphs
{ 'R' => [[1, 1, 1, 0], [1, 0, 0, 1], [1, 1, 1, 0], [1, 0, 1, 0], [1, 0, 0, 1]], 'U' => [[1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1], [0, 1, 1, 0]], 'B' => [[1, 1, 1, 0], [1, 0, 0, 1], [1, 1, 1, 0], [1, 0, 0, 1], [1, 1, 1, 0]], 'Y' => [[1, 0, 0, 1], [1, 0, 0, 1], [0, 1, 1, 0], [0, 0, 1, 0], [0, 0, 1, 0]], ' ' => [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]], 'A' => [[0, 1, 1, 0], [1, 0, 0, 1], [1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1]], 'I' => [[1, 1, 1], [0, 1, 0], [0, 1, 0], [0, 1, 0], [1, 1, 1]], 'D' => [[1, 1, 1, 0], [1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 0]], 'E' => [[1, 1, 1, 1], [1, 0, 0, 0], [1, 1, 1, 0], [1, 0, 0, 0], [1, 1, 1, 1]] }.freeze
- TEXT_COLOR =
3
Class Method Summary collapse
Class Method Details
.display ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/utilities/logo.rb', line 40 def self.display text_rows = build_text('RUBY RAIDER') text_width = text_rows.first.length # Build 6-row text grid: blank top row centers text vertically with gem text_grid = [Array.new(text_width, 0)] text_rows.each { |row| text_grid << row.map { |px| px == 1 ? TEXT_COLOR : 0 } } # Compose: gem(9) + gap(2) + text grid = 6.times.map { |y| GEM[y] + [0, 0] + text_grid[y] } # Render 3 terminal rows (each encodes 2 pixel rows via half-blocks) 3.times do |tr| line = +'' top = grid[tr * 2] bot = grid[tr * 2 + 1] top.length.times { |x| line << halfblock(top[x], bot[x]) } puts " #{line.rstrip}" end puts end |