mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 05:22:23 +00:00
Nicer ansi rendering
This commit is contained in:
parent
9824431317
commit
b43501da98
@ -4,6 +4,7 @@ require "./formatter"
|
|||||||
require "./rules"
|
require "./rules"
|
||||||
require "./styles"
|
require "./styles"
|
||||||
require "./tartrazine"
|
require "./tartrazine"
|
||||||
|
|
||||||
# These are Lexer actions. When a rule matches, it will
|
# These are Lexer actions. When a rule matches, it will
|
||||||
# perform a list of actions. These actions can emit tokens
|
# perform a list of actions. These actions can emit tokens
|
||||||
# or change the state machine.
|
# or change the state machine.
|
||||||
|
@ -44,7 +44,12 @@ module Tartrazine
|
|||||||
theme.styles.has_key?(parent)
|
theme.styles.has_key?(parent)
|
||||||
}]
|
}]
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
def rgb(c : String?)
|
def rgb(c : String?)
|
||||||
|
Loading…
Reference in New Issue
Block a user