terminal_rb 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 03611bf9c12091c1899cf96f9b4bc8b116e8e6a7a83722cbd8cbfc0fdec0aa50
4
+ data.tar.gz: 9645a8ee9fb60c745804ac370492d81e8d217bfce58209a5f8a7b1dba4fc9631
5
+ SHA512:
6
+ metadata.gz: d665b9b9c43b7a6df18248ae8a1d12ef791de691bc2a4b6bbe44790ee361af781cedbe9dfab020700c4f989f2f3e7126d30560b8a8eadc1d92251a16c5774733
7
+ data.tar.gz: 1dff9e55da621dd5b86ee3e887b4d234f972198c2123c3be0f4a71ae256b60d15bd89ad19a731a572c757d5372ac0c98d00736481e73a558771f5ec8417ecf17
data/.yardopts ADDED
@@ -0,0 +1,11 @@
1
+ --title 'Terminal.rb'
2
+ --charset utf-8
3
+ --markup markdown
4
+ --readme README.md
5
+ --no-private
6
+ --embed-mixins
7
+ --tag comment
8
+ --hide-tag comment
9
+ lib/**/*.rb
10
+ -
11
+ README.md
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # Terminal.rb ![version](https://img.shields.io/gem/v/terminal_rb?label=)
2
+
3
+ Terminal access with support for ANSI control codes and [BBCode-like](https://en.wikipedia.org/wiki/BBCode) embedded text attribute syntax.
4
+
5
+ - Gem: [rubygems.org](https://rubygems.org/gems/terminal_rb)
6
+ - Source: [codeberg.org](https://codeberg.org/mblumtritt/Terminal.rb)
7
+ - Help: [rubydoc.info](https://rubydoc.info/gems/terminal_rb/Terminal)
8
+
9
+ ## Features
10
+
11
+ - terminal emulator application detection
12
+ - ANSI support detection
13
+ - color depth detection
14
+ - [NO_COLOR convention](https://no-color.org) support
15
+ - markup of text attributes and colors using a [BBCode](https://en.wikipedia.org/wiki/BBCode)-like syntax
16
+ - calculation for correct display width of strings containing Unicdode chars inclusive emojis
17
+ - word-wise text wrapper
18
+ - easy to use key codes
19
+
20
+ ## Examples
21
+
22
+ ### Check if ANSI is supported
23
+
24
+ ```ruby
25
+ Terminal.ansi?
26
+ # => true when current terminal emulator supports ANSI control codes
27
+ ```
28
+
29
+ ### Print with embedded formatting
30
+
31
+ ```ruby
32
+ Terminal.puts "[red on_bright_yellow bold]Hello World![/]"
33
+ ```
34
+
35
+ Have a look at the [examples](./examples/) directory to learn from code.
36
+
37
+ ## Installation
38
+
39
+ You can install the gem in your system with
40
+
41
+ ```shell
42
+ gem install terminal_rb
43
+ ```
44
+
45
+ or you can use [Bundler](http://gembundler.com/) to add Terminal to your own project:
46
+
47
+ ```shell
48
+ bundle add terminal_rb
49
+ ```
50
+
51
+ After that you only need one line of code to have everything together
52
+
53
+ ```ruby
54
+ require 'terminal'
55
+ ```
data/bin/bbcode ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby --disable-all
2
+ # frozen_string_literal: true
3
+
4
+ def me = File.basename(Process.argv0)
5
+ puts(<<~HELP) || exit if ARGV.delete('-h') || ARGV.delete('--help')
6
+ usage: #{me} [OPTION] [FILE, ...]
7
+
8
+ Interprete BBCode of given files or stdin and print to stdout.
9
+
10
+ Options:
11
+ -A, --no-ansi remove ANSI control codes
12
+ -B, --no-bbcode remove BBCodes
13
+ HELP
14
+
15
+ begin
16
+ case ARGV[0]
17
+ when '-v', '--version'
18
+ puts("#{me} v1.0") || exit if ARGV.size == 1
19
+ when '-A', '--no-ansi'
20
+ no_ansi = ARGV.shift
21
+ when '-B', '--no-bbcode'
22
+ no_bbcode = ARGV.shift
23
+ when '-AB', '-BA'
24
+ no_ansi = no_bbcode = ARGV.shift
25
+ when '--auto'
26
+ ARGV.shift
27
+ require_relative('../lib/terminal')
28
+ no_ansi = no_bbcode = true unless Terminal.ansi?
29
+ end
30
+ require_relative('../lib/terminal/ansi')
31
+ $stdout.write(
32
+ Terminal::Ansi.send(
33
+ if no_ansi
34
+ no_bbcode ? :plain : :undecorate
35
+ else
36
+ no_bbcode ? :unbbcode : :bbcode
37
+ end,
38
+ ARGF.read
39
+ )
40
+ )
41
+ rescue IOError, SystemCallError => e
42
+ $stderr.puts "#{me}-error: #{e.message.gsub(/@ \w+ /, '')}"
43
+ exit 1
44
+ rescue Interrupt
45
+ exit 138
46
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/terminal'
4
+
5
+ colors =
6
+ Terminal::Ansi
7
+ .named_colors
8
+ .delete_if { /\d/.match?(_1) }
9
+ .map! { "[on_#{_1}] [/] [#{_1}]#{_1.to_s.ljust(22)}[/]" }
10
+ .each_slice(3)
11
+ .map(&:join)
12
+ .join("\n")
13
+
14
+ Terminal.puts <<~TEXT
15
+
16
+ ✅ [b bright_green]Terminal.rb[/b] — 24bit-Colors:[/]
17
+
18
+ #{colors}
19
+
20
+ TEXT
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/terminal'
4
+
5
+ Terminal.puts <<~TEXT
6
+
7
+ ✅ [b bright_green]Terminal.rb[/b] — 3/4bit-Colors:[/]
8
+
9
+ [on_black] [/] [black]black[/] [on_bright_black] [/] [bright_black]bright_black[/]
10
+ [on_red] [/] [red]red[/] [on_bright_red] [/] [bright_red]bright_red[/]
11
+ [on_green] [/] [green]green[/] [on_bright_green] [/] [bright_green]bright_green[/]
12
+ [on_yellow] [/] [yellow]yellow[/] [on_bright_yellow] [/] [bright_yellow]bright_yellow[/]
13
+ [on_blue] [/] [blue]blue[/] [on_bright_blue] [/] [bright_blue]bright_blue[/]
14
+ [on_magenta] [/] [magenta]magenta[/] [on_bright_magenta] [/] [bright_magenta]bright_magenta[/]
15
+ [on_cyan] [/] [cyan]cyan[/] [on_bright_cyan] [/] [bright_cyan]bright_cyan[/]
16
+ [on_white] [/] [white]white[/] [on_bright_white] [/] [bright_white]bright_white[/]
17
+
18
+ TEXT
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/terminal'
4
+
5
+ Terminal.puts <<~TEXT
6
+
7
+ ✅ [b bright_green]Terminal.rb[/b] — 8bit-Colors:[/]
8
+
9
+ System Colors
10
+ [on_0] 00 [on_1] 01 [on_2] 02 [on_3] 03 [on_4] 04 [on_5] 05 [on_6] 06 [on_7] 07 [/]
11
+ [on_8] 08 [on_9] 09 [on_a] 0a [on_b] 0b [on_c] 0c [on_d] 0d [on_e] 0e [on_e] 0f [/]
12
+
13
+ Grayscale
14
+ [on_e8] e8 [on_e9] e9 [on_ea] ea [on_eb] eb [on_ec] ec [on_ed] ed [on_ee] ee [on_ef] ef [on_f0] f0 [on_f1] f1 [on_f2] f2 [on_f3] f3 [/]
15
+ [on_f4] f4 [on_f5] f5 [on_f6] f6 [on_f7] f7 [on_f8] f8 [on_f9] f9 [on_fa] fa [on_fb] fb [on_fc] fc [on_fd] fd [on_fe] fe [on_ff] ff [/]
16
+
17
+ 6x6 Color Cubes
18
+ [on_10] 10 [on_11] 11 [on_12] 12 [on_13] 13 [on_14] 14 [on_15] 15 [/] [on_16] 16 [on_17] 17 [on_18] 18 [on_19] 19 [on_1a] 1a [on_1b] 1b [/] [on_1c] 1c [on_1d] 1d [on_1e] 1e [on_1f] 1f [on_20] 20 [on_21] 21 [/]
19
+ [on_34] 34 [on_35] 35 [on_36] 36 [on_37] 37 [on_38] 38 [on_39] 39 [/] [on_3a] 3a [on_3b] 3b [on_3c] 3c [on_3d] 3d [on_3e] 3e [on_3f] 3f [/] [on_40] 40 [on_41] 41 [on_42] 42 [on_43] 43 [on_44] 44 [on_45] 45 [/]
20
+ [on_58] 58 [on_59] 59 [on_5a] 5a [on_5b] 5b [on_5c] 5c [on_5d] 5d [/] [on_5e] 5e [on_5f] 5f [on_60] 60 [on_61] 61 [on_62] 62 [on_63] 63 [/] [on_64] 64 [on_65] 65 [on_66] 66 [on_67] 67 [on_68] 68 [on_69] 69 [/]
21
+ [on_7c] 7c [on_7d] 7d [on_7e] 7e [on_7f] 7f [on_80] 80 [on_81] 81 [/] [on_82] 82 [on_83] 83 [on_84] 84 [on_85] 85 [on_86] 86 [on_87] 87 [/] [on_88] 88 [on_89] 89 [on_8a] 8a [on_8b] 8b [on_8c] 8c [on_8d] 8d [/]
22
+ [on_a0] a0 [on_a1] a1 [on_a2] a2 [on_a3] a3 [on_a4] a4 [on_a5] a5 [/] [on_a6] a6 [on_a7] a7 [on_a8] a8 [on_a9] a9 [on_aa] aa [on_ab] ab [/] [on_ac] ac [on_ad] ad [on_ae] ae [on_af] af [on_b0] b0 [on_b1] b1 [/]
23
+ [on_c4] c4 [on_c5] c5 [on_c6] c6 [on_c7] c7 [on_c8] c8 [on_c9] c9 [/] [on_ca] ca [on_cb] cb [on_cc] cc [on_cd] cd [on_ce] ce [on_cf] cf [/] [on_d0] d0 [on_d1] d1 [on_d2] d2 [on_d3] d3 [on_d4] d4 [on_d5] d5 [/]
24
+
25
+ [on_22] 22 [on_23] 23 [on_24] 24 [on_25] 25 [on_26] 26 [on_27] 27 [/] [on_28] 28 [on_29] 29 [on_2a] 2a [on_2b] 2b [on_2c] 2c [on_2d] 2d [/] [on_2e] 2e [on_2f] 2f [on_30] 30 [on_31] 31 [on_32] 32 [on_33] 33 [/]
26
+ [on_46] 46 [on_47] 47 [on_48] 48 [on_49] 49 [on_4a] 4a [on_4b] 4b [/] [on_4c] 4c [on_4d] 4d [on_4e] 4e [on_4f] 4f [on_50] 50 [on_51] 51 [/] [on_52] 52 [on_53] 53 [on_54] 54 [on_55] 55 [on_56] 56 [on_57] 57 [/]
27
+ [on_6a] 6a [on_6b] 6b [on_6c] 6c [on_6d] 6d [on_6e] 6e [on_6f] 6f [/] [on_70] 70 [on_71] 71 [on_72] 72 [on_73] 73 [on_74] 74 [on_75] 75 [/] [on_76] 76 [on_77] 77 [on_78] 78 [on_79] 79 [on_7a] 7a [on_7b] 7b [/]
28
+ [on_8e] 8e [on_8f] 8f [on_90] 90 [on_91] 91 [on_92] 92 [on_93] 93 [/] [on_94] 94 [on_95] 95 [on_96] 96 [on_97] 97 [on_98] 98 [on_99] 99 [/] [on_9a] 9a [on_9b] 9b [on_9c] 9c [on_9d] 9d [on_9e] 9e [on_9f] 9f [/]
29
+ [on_b2] b2 [on_b3] b3 [on_b4] b4 [on_b5] b5 [on_b6] b6 [on_b7] b7 [/] [on_b8] b8 [on_b9] b9 [on_ba] ba [on_bb] bb [on_bc] bc [on_bd] bd [/] [on_be] be [on_bf] bf [on_c0] c0 [on_c1] c1 [on_c2] c2 [on_c3] c3 [/]
30
+ [on_d6] d6 [on_d7] d7 [on_d8] d8 [on_d9] d9 [on_da] da [on_db] db [/] [on_dc] dc [on_dd] dd [on_de] de [on_df] df [on_e0] e0 [on_e1] e1 [/] [on_e2] e2 [on_e3] e3 [on_e4] e4 [on_e5] e5 [on_e6] e6 [on_e7] e7 [/]
31
+
32
+ TEXT
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/terminal'
4
+
5
+ Terminal.puts <<~TEXT
6
+
7
+ ✅ [b bright_green]Terminal.rb[/b] — Attributes:[/]
8
+
9
+ Terminal.rb supports all well known attributes like [b]bold[/b], [i]italic[/i], [u]underline[/u],
10
+ [blink]blink[/blink], [inv]invert[/inv] and [strike]strike[/strike]. Other attributes like [faint]faint[/faint], [double_underline]double underline[/], [curly_underline]curly
11
+ underline[/], [dotted_underline]dotted underline[/], [dashed_underline]dashed underline[/], etc. and alternative fonts like
12
+ [fraktur]fraktur[/] are not widely used by terminal emulators but supported by Terminal.rb.
13
+
14
+ TEXT
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/terminal'
4
+
5
+ Terminal.puts <<~TEXT
6
+
7
+ ✅ [b bright_green]Terminal.rb::Ansi[/b] — BBCode:[/]
8
+
9
+ [b]Bold[/b] [\\b]...[\\/b] or [\\bold]...[\\/bold]
10
+ [faint]Faint[/faint] [\\faint]...[\\/faint]
11
+ [i]Italic[/i] [\\i]...[\\/i] or [\\|italic]...[\\/italic]
12
+ [inv]Invert[/inv] [\\inv]...[\\/inv] or [\\invert]...[\\/invert]
13
+ [strike]Strike[/strike] [\\strike]...[\\/strike]
14
+ [h]Hide[/h] [\\h]...[\\/h] or [\\hide]...[\\/hide] or [\\conceal]...[\\/conceal]
15
+ [blink]Slow blink[/blink] [\\blink]...[\\/blink] or [\\slow_blink]...[\\/slow_blink]
16
+ [u]Underline[/u] [\\u]...[\\/u] or [\\underline]...[\\/underline]
17
+ [uu]Double underline[/uu] [\\uu]...[\\/uu] or [\\double_underline]...[\\/double_underline]
18
+ [cu]Curly underline[/cu] [\\cu]...[\\/cu] or [\\curly_underline]...[\\/curly_underline]
19
+ [dau]Dashed underline[/dau] [\\dau]...[\\/dau] or [\\dashed_underline]...[\\/dashed_underline]
20
+ [dou]Dotted underline[/dou] [\\dou]...[\\/dou] or [\\dotted_underline]...[\\/dotted_underline]
21
+ [fraktur]Fraktur[/fraktur] [\\fraktur]...[\\/fraktur]
22
+ [framed]Framed[/framed] [\\framed]...[\\/framed]
23
+ [encircled]Encircled[/encircled] [\\encircled]...[\\/encircled]
24
+ [ovr]Overlined[/ovr] [\\ovr]...[\\/ovr] or [\\overlined]...[\\/overlined]
25
+ [sub]Subscript[/sub] [\\sub]...[\\/sub] or [\\subscript]...[\\/subscript]
26
+ [sup]Superscript[/sup] [\\sup]...[\\/sup] or [\\superscript]...[\\/superscript]
27
+
28
+ TEXT
data/examples/info.rb ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/terminal'
4
+
5
+ Terminal.puts <<~TEXT
6
+
7
+ ✅ [b bright_green]Terminal.rb[/b] — Terminal Info:[/]
8
+
9
+ Ansi mode: #{Terminal.ansi? ? '✓' : '𐄂'}
10
+ Application: #{Terminal.application}
11
+ Supported Colors: #{Terminal.colors}#{' (truecolor)' if Terminal.true_color?}
12
+ Terminal Size: #{Terminal.size.join(' x ')}
13
+ Cursor Position: #{Terminal.pos.join(', ')}
14
+
15
+ TEXT
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lib/terminal'
4
+
5
+ Terminal.puts <<~TEXT
6
+
7
+ ✅ [b bright_green]Terminal.rb[/b] — Key Codes:[/]
8
+ Press any key to display it's control code and name.
9
+ [bright_black](Exit with Ctrl+C)[/]
10
+
11
+ TEXT
12
+
13
+ Terminal.hide_cursor
14
+ at_exit { Terminal.show_cursor } # required for some terminals :/
15
+
16
+ while true
17
+ raw, name = Terminal.read_key(mode: :both)
18
+ Terminal.puts(
19
+ " [blue]: [yellow]#{raw.inspect} [bold bright_green]#{name}[/]"
20
+ )
21
+ break puts if name == 'Ctrl+C'
22
+ end
@@ -0,0 +1,209 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Terminal
4
+ module Ansi
5
+ ATTRIBUTES = {
6
+ '/' => '',
7
+ '/b' => '22',
8
+ '/blink' => '25',
9
+ '/bold' => '22',
10
+ '/conceal' => '28',
11
+ '/cu' => '4:0',
12
+ '/curly_underline' => '4:0',
13
+ '/dashed_underline' => '4:0',
14
+ '/dau' => '4:0',
15
+ '/dim' => '22',
16
+ '/dotted_underline' => '4:0',
17
+ '/dou' => '4:0',
18
+ '/double_underline' => '24',
19
+ '/encircled' => '54',
20
+ '/faint' => '22',
21
+ '/fraktur' => '23',
22
+ '/framed' => '54',
23
+ '/h' => '28',
24
+ '/hide' => '28',
25
+ '/i' => '23',
26
+ '/inv' => '27',
27
+ '/invert' => '27',
28
+ '/italic' => '23',
29
+ '/overlined' => '55',
30
+ '/ovr' => '55',
31
+ '/proportional' => '50',
32
+ '/slow_blink' => '25',
33
+ '/spacing' => '50',
34
+ '/strike' => '29',
35
+ '/sub' => '75',
36
+ '/subscript' => '75',
37
+ '/sup' => '75',
38
+ '/superscript' => '75',
39
+ '/u' => '24',
40
+ '/underline' => '24',
41
+ '/uu' => '24',
42
+ 'b' => '1',
43
+ 'blink' => '5',
44
+ 'blink_off' => '25',
45
+ 'bold' => '1',
46
+ 'bold_off' => '22',
47
+ 'conceal' => '8',
48
+ 'cu' => '4:3',
49
+ 'curly_underline' => '4:3',
50
+ 'curly_underline_off' => '4:0',
51
+ 'dashed_underline' => '4:5',
52
+ 'dashed_underline_off' => '4:0',
53
+ 'dau' => '4:5',
54
+ 'default_font' => '10',
55
+ 'dim' => '2',
56
+ 'dotted_underline' => '4:4',
57
+ 'dotted_underline_off' => '4:0',
58
+ 'dou' => '4:4',
59
+ 'double_underline' => '21',
60
+ 'double_underline_off' => '24',
61
+ 'encircled' => '52',
62
+ 'encircled_off' => '54',
63
+ 'faint' => '2',
64
+ 'faint_off' => '22',
65
+ 'font1' => '11',
66
+ 'font2' => '12',
67
+ 'font3' => '13',
68
+ 'font4' => '14',
69
+ 'font5' => '15',
70
+ 'font6' => '16',
71
+ 'font7' => '17',
72
+ 'font8' => '18',
73
+ 'font9' => '19',
74
+ 'fraktur' => '20',
75
+ 'fraktur_off' => '23',
76
+ 'framed' => '51',
77
+ 'framed_off' => '54',
78
+ 'h' => '8',
79
+ 'hide' => '8',
80
+ 'hide_off' => '28',
81
+ 'i' => '3',
82
+ 'inv' => '7',
83
+ 'invert' => '7',
84
+ 'invert_off' => '27',
85
+ 'italic' => '3',
86
+ 'italic_off' => '23',
87
+ 'overlined' => '53',
88
+ 'overlined_off' => '55',
89
+ 'ovr' => '53',
90
+ 'primary_font' => '10',
91
+ 'proportional' => '26',
92
+ 'proportional_off' => '50',
93
+ 'rapid_blink' => '6',
94
+ 'reset' => '',
95
+ 'reveal' => '28',
96
+ 'slow_blink' => '5',
97
+ 'spacing' => '26',
98
+ 'strike' => '9',
99
+ 'strike_off' => '29',
100
+ 'sub' => '74',
101
+ 'subscript' => '74',
102
+ 'subscript_off' => '75',
103
+ 'sup' => '73',
104
+ 'superscript' => '73',
105
+ 'superscript_off' => '75',
106
+ 'u' => '4',
107
+ 'underline' => '4',
108
+ 'underline_off' => '24',
109
+ 'uu' => '21'
110
+ }.freeze
111
+
112
+ COLORS = {
113
+ '/bg' => '49',
114
+ '/fg' => '39',
115
+ '/ul' => '59',
116
+ 'bg_black' => '40',
117
+ 'bg_blue' => '44',
118
+ 'bg_bright_black' => '100',
119
+ 'bg_bright_blue' => '104',
120
+ 'bg_bright_cyan' => '106',
121
+ 'bg_bright_green' => '102',
122
+ 'bg_bright_magenta' => '105',
123
+ 'bg_bright_red' => '101',
124
+ 'bg_bright_white' => '107',
125
+ 'bg_bright_yellow' => '103',
126
+ 'bg_cyan' => '46',
127
+ 'bg_default' => '49',
128
+ 'bg_green' => '42',
129
+ 'bg_magenta' => '45',
130
+ 'bg_red' => '41',
131
+ 'bg_white' => '47',
132
+ 'bg_yellow' => '43',
133
+ 'black' => '30',
134
+ 'blue' => '34',
135
+ 'bright_black' => '90',
136
+ 'bright_blue' => '94',
137
+ 'bright_cyan' => '96',
138
+ 'bright_green' => '92',
139
+ 'bright_magenta' => '95',
140
+ 'bright_red' => '91',
141
+ 'bright_white' => '97',
142
+ 'bright_yellow' => '93',
143
+ 'cyan' => '36',
144
+ 'default' => '39',
145
+ 'fg_black' => '30',
146
+ 'fg_blue' => '34',
147
+ 'fg_bright_black' => '90',
148
+ 'fg_bright_blue' => '94',
149
+ 'fg_bright_cyan' => '96',
150
+ 'fg_bright_green' => '92',
151
+ 'fg_bright_magenta' => '95',
152
+ 'fg_bright_red' => '91',
153
+ 'fg_bright_white' => '97',
154
+ 'fg_bright_yellow' => '93',
155
+ 'fg_cyan' => '36',
156
+ 'fg_default' => '39',
157
+ 'fg_green' => '32',
158
+ 'fg_magenta' => '35',
159
+ 'fg_red' => '31',
160
+ 'fg_white' => '37',
161
+ 'fg_yellow' => '33',
162
+ 'green' => '32',
163
+ 'magenta' => '35',
164
+ 'on_black' => '40',
165
+ 'on_blue' => '44',
166
+ 'on_bright_black' => '100',
167
+ 'on_bright_blue' => '104',
168
+ 'on_bright_cyan' => '106',
169
+ 'on_bright_green' => '102',
170
+ 'on_bright_magenta' => '105',
171
+ 'on_bright_red' => '101',
172
+ 'on_bright_white' => '107',
173
+ 'on_bright_yellow' => '103',
174
+ 'on_cyan' => '46',
175
+ 'on_default' => '49',
176
+ 'on_green' => '42',
177
+ 'on_magenta' => '45',
178
+ 'on_red' => '41',
179
+ 'on_white' => '47',
180
+ 'on_yellow' => '43',
181
+ 'red' => '31',
182
+ 'ul_black' => '58;2;0;0;0',
183
+ 'ul_blue' => '58;2;0;0;128',
184
+ 'ul_bright_black' => '58;2;64;64;64',
185
+ 'ul_bright_blue' => '58;2;0;0;255',
186
+ 'ul_bright_cyan' => '58;2;0;255;255',
187
+ 'ul_bright_green' => '58;2;0;255;0',
188
+ 'ul_bright_magenta' => '58;2;255;0;255',
189
+ 'ul_bright_red' => '58;2;255;0;0',
190
+ 'ul_bright_white' => '58;2;255;255;255',
191
+ 'ul_bright_yellow' => '58;2;255;255;0',
192
+ 'ul_cyan' => '58;2;0;128;128',
193
+ 'ul_default' => '59',
194
+ 'ul_green' => '58;2;0;128;0',
195
+ 'ul_magenta' => '58;2;128;0;128',
196
+ 'ul_red' => '58;2;128;0;0',
197
+ 'ul_white' => '58;2;128;128;128',
198
+ 'ul_yellow' => '58;2;128;128;0',
199
+ 'white' => '37',
200
+ 'yellow' => '33'
201
+ }.freeze
202
+
203
+ ATTRIBUTES_S =
204
+ ATTRIBUTES.transform_keys(&:to_sym).compare_by_identity.freeze
205
+ COLORS_S = COLORS.transform_keys(&:to_sym).compare_by_identity.freeze
206
+
207
+ private_constant :ATTRIBUTES, :COLORS, :ATTRIBUTES_S, :COLORS_S
208
+ end
209
+ end