mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-05-05 22:31:11 +08:00
Add color command
This commit is contained in:
parent
9e2f169e6c
commit
05c3b14acd
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user