mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-12 22:42:23 +00:00
Nicer ansi rendering
This commit is contained in:
parent
9824431317
commit
b43501da98
@ -4,6 +4,7 @@ require "./formatter"
|
||||
require "./rules"
|
||||
require "./styles"
|
||||
require "./tartrazine"
|
||||
|
||||
# These are Lexer actions. When a rule matches, it will
|
||||
# perform a list of actions. These actions can emit tokens
|
||||
# or change the state machine.
|
||||
|
@ -44,7 +44,12 @@ module Tartrazine
|
||||
theme.styles.has_key?(parent)
|
||||
}]
|
||||
end
|
||||
text.colorize(*rgb(s.color)).back(*rgb(s.background)).to_s
|
||||
colorized = text.colorize(*rgb(s.color))
|
||||
# Intentionally not setting background color
|
||||
colorized.mode(:bold) if s.bold
|
||||
colorized.mode(:italic) if s.italic
|
||||
colorized.mode(:underline) if s.underline
|
||||
colorized.to_s
|
||||
end
|
||||
|
||||
def rgb(c : String?)
|
||||
|
Loading…
Reference in New Issue
Block a user