mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Move color constants to a private named tuple
This commit is contained in:
parent
1a998b6cb6
commit
bd500b0799
1 changed files with 13 additions and 19 deletions
|
@ -5,44 +5,38 @@ module Spectator::Formatters
|
||||||
module Color
|
module Color
|
||||||
extend self
|
extend self
|
||||||
|
|
||||||
# Symbol in `Colorize` representing success.
|
# Symbols in `Colorize` representing result types and formatting types.
|
||||||
SUCCESS_COLOR = :green
|
private COLORS = {
|
||||||
|
success: :green,
|
||||||
# Symbol in `Colorize` representing failure.
|
failure: :red,
|
||||||
FAILURE_COLOR = :red
|
error: :magenta,
|
||||||
|
pending: :yellow,
|
||||||
# Symbol in `Colorize` representing an error.
|
comment: :cyan,
|
||||||
ERROR_COLOR = :magenta
|
}
|
||||||
|
|
||||||
# Symbol in `Colorize` representing pending or skipped.
|
|
||||||
PENDING_COLOR = :yellow
|
|
||||||
|
|
||||||
# Symbol in `Colorize` representing a comment in output.
|
|
||||||
COMMENT_COLOR = :cyan
|
|
||||||
|
|
||||||
# Colorizes some text with the success color.
|
# Colorizes some text with the success color.
|
||||||
def success(text)
|
def success(text)
|
||||||
text.colorize(SUCCESS_COLOR)
|
text.colorize(COLORS[:success])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Colorizes some text with the failure color.
|
# Colorizes some text with the failure color.
|
||||||
def failure(text)
|
def failure(text)
|
||||||
text.colorize(FAILURE_COLOR)
|
text.colorize(COLORS[:failure])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Colorizes some text with the error color.
|
# Colorizes some text with the error color.
|
||||||
def error(text)
|
def error(text)
|
||||||
text.colorize(ERROR_COLOR)
|
text.colorize(COLORS[:error])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Colorizes some text with the pending/skipped color.
|
# Colorizes some text with the pending/skipped color.
|
||||||
def pending(text)
|
def pending(text)
|
||||||
text.colorize(PENDING_COLOR)
|
text.colorize(COLORS[:pending])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Colorizes some text with the comment color.
|
# Colorizes some text with the comment color.
|
||||||
def comment(text)
|
def comment(text)
|
||||||
text.colorize(COMMENT_COLOR)
|
text.colorize(COLORS[:comment])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue