Module: Przn::KittyText

Defined in:
lib/przn/kitty_text.rb

Constant Summary collapse

HEADING_SCALES =
{
  1 => 4,
  2 => 3,
  3 => 2,
}.freeze

Class Method Summary collapse

Class Method Details

.heading(text, level:) ⇒ Object



23
24
25
26
27
28
# File 'lib/przn/kitty_text.rb', line 23

def heading(text, level:)
  scale = HEADING_SCALES[level]
  return text unless scale

  sized(text, s: scale, h: 1)
end

.sized(text, s:, h: nil, v: nil, n: nil, d: nil, f: nil) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/przn/kitty_text.rb', line 13

def sized(text, s:, h: nil, v: nil, n: nil, d: nil, f: nil)
  params = +"s=#{s}"
  params << ":n=#{n}" if n
  params << ":d=#{d}" if d
  params << ":h=#{h}" if h
  params << ":v=#{v}" if v
  params << ":f=#{f}" if f
  "\e]66;#{params};#{text}\a"
end