Add BBS::Color module with c() helper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require_relative 'bbs/color'
|
||||||
require_relative 'bbs/config'
|
require_relative 'bbs/config'
|
||||||
require_relative 'bbs/telnet'
|
require_relative 'bbs/telnet'
|
||||||
require_relative 'bbs/banner'
|
require_relative 'bbs/banner'
|
||||||
|
|||||||
17
lib/bbs/color.rb
Normal file
17
lib/bbs/color.rb
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module BBS
|
||||||
|
module Color
|
||||||
|
COLORS = {
|
||||||
|
reset: "\e[0m", gray: "\e[0;37m", yellow: "\e[0;33m",
|
||||||
|
white: "\e[1;37m", blue: "\e[0;34m", cyan: "\e[0;36m",
|
||||||
|
green: "\e[1;32m", magenta: "\e[0;35m", red: "\e[1;31m"
|
||||||
|
}.freeze
|
||||||
|
|
||||||
|
module_function
|
||||||
|
|
||||||
|
def c(color, text)
|
||||||
|
"#{COLORS.fetch(color)}#{text}#{COLORS[:reset]}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user