Add color command

This commit is contained in:
kojix2 2020-08-24 20:17:33 +09:00
parent 9e2f169e6c
commit 05c3b14acd
2 changed files with 23 additions and 0 deletions

View File

@ -193,6 +193,11 @@ module Uplot
params.xlim = get_lim(v)
end
parsers[:colors]
.on('-n', '--names', TrueClass) do |v|
@color_names = v
end
# Preventing the generation of new sub-commands
parsers.default = nil
@ -242,6 +247,12 @@ module Uplot
def run
parse_options
if command == :colors
Plot.colors
exit
end
# Sometimes the input file does not end with a newline code.
while input = Kernel.gets(nil)
input.freeze

View File

@ -123,6 +123,18 @@ module Uplot
UnicodePlot.boxplot(headers, series, **params.to_hc)
end
def colors
UnicodePlot::StyledPrinter::TEXT_COLORS.each do |k,v|
print v
print k
print "\t"
print ""
print "\033[0m"
print "\t"
end
puts
end
def check_series_size(data, fmt)
series = data.series
if series.size == 1