term-ansicolor-1.11.3/0000755000004100000410000000000015062753465014600 5ustar www-datawww-dataterm-ansicolor-1.11.3/bin/0000755000004100000410000000000015062753465015350 5ustar www-datawww-dataterm-ansicolor-1.11.3/bin/term_plasma0000755000004100000410000000514515062753465017607 0ustar www-datawww-data#!/usr/bin/env ruby require 'tins/go' include Tins::GO require 'term/ansicolor' include Term::ANSIColor Term::ANSIColor.true_coloring = ENV['COLORTERM'] =~ /\A(truecolor|24bit)\z/ include Math # Generates a palette of 256 colors based on sine waves # # @return [Array>] An array of arrays, each containing # three integers representing the RGB values of a color. def generate_palette (0..255).map { |i| [ 128 + 128 * sin(PI * i / 32.0), 128 + 128 * sin(PI * i / 64.0), 128 + 128 * sin(PI * i / 128.0), ].map { _1.clamp(0, 255).round } } end # Resets the terminal to its original state, and assigns width $w and height # $h. def full_reset $w, $h = Tins::Terminal.cols, Tins::Terminal.lines $h *= 2 print reset, clear_screen, move_home, hide_cursor end # Generates a screen based on a plasma. # # @param plasma [Array>] An array of arrays, each containing # three integers representing the RGB values of a color. # @return [String] The string representation of the screen, each character # representing a pixel on the screen with the corresponding color. def generate_screen(plasma) screen = '' 0.step($h - 1, 2) do |y| 0.upto($w - 1) do |x| screen << color(plasma[y][x]) + on_color(plasma[y + 1][x]) + ?▀ end end screen end # Generates a plasma generated based on sine waves # # @param now [Float] A value based on the current time in seconds # @return [Array>] An array of arrays, each containing # three integers representing the RGB values of a color. def generate_plasma(now) plasma = Array.new($h) { [ nil ] * $w } 0.upto($h - 1) do |y| 0.upto($w - 1) do |x| x, y = x.to_f, y.to_f color = ( 128.0 + (128.0 * sin((x / 7.0) - 3.0 * cos(now / 2.0))) + 128.0 + (128.0 * sin((y / 13.0) - 2.0 * sin(now))) + 128.0 + (128.0 * sin(hypot((x - $w / 3.0), (y - $h / 2.0)) / 5.0)) + 128.0 + (128.0 * sin((hypot(x, y) / 5.0) - sin(now / 3.0))) ) / 4.0 plasma[y][x] = $palette[(color + now).round % $palette.size] end end plasma end $opts = go('n:') $palette = generate_palette begin $full_reset = true trap(:SIGWINCH) { $full_reset = true } loop do if $full_reset $full_reset = false full_reset end now = Time.now.to_f / ($opts[?n]&.to_f || 1) plasma = generate_plasma(now) print move_home, generate_screen(plasma), reset if n = $opts[?n]&.to_f sleep n else print move_to_column(1), erase_in_line, show_cursor exit end end rescue Interrupt print reset, clear_screen, move_home, show_cursor end term-ansicolor-1.11.3/bin/term_display0000755000004100000410000000476315062753465020004 0ustar www-datawww-data#!/usr/bin/env ruby require 'tempfile' require 'term/ansicolor' require 'open-uri' require 'tins/xt' include Tins::GO def provide_ppm_file(filename, opts) pnmtopnm = `which pnmtopnm` if pnmtopnm.empty? STDERR.puts "You might consider installing netpbm to enable image conversion/scaling!" File.new(filename, 'rb') else cmd = [ pnmtopnm.chomp! ] ext = File.extname(filename) scale = `which pamscale`.chomp! console_scale = "#{scale} -#{opts['s']} #{opts['C']} #{opts['R']}" cmd.unshift console_scale aspect_scaling = "#{scale} -xscale #{opts['a']}" cmd.unshift aspect_scaling convert_to_pnm = case ext when /\A(\.ppm\d*|\.pnm|\z)/ '' when /\A.(jpe?g|exif|jfif)\z/i 'jpegtopnm' when /\A.tiff?\z/i 'tifftopnm' else "#{ext[1..-1].downcase}topnm" end unless convert_to_pnm.empty? convert_to_pnm = `which #{convert_to_pnm}`.chomp! convert_to_pnm.empty? and fail "unknown pnm converter #{convert_to_pnm}" cmd.unshift convert_to_pnm end temp = Tempfile.open(File.basename($0)) cmd *= '|' STDERR.puts "Executing #{cmd.inspect}" IO.popen(cmd, 'r+') do |converter| open(filename, 'rb') do |input| until input.eof? converter.write input.read(8192) end converter.close_write end until converter.eof? temp.write(converter.read) end end temp.tap(&:rewind) end end def usage(rc = 0) puts < wind sf.x -= 1 if sf.x <= 0 sf.x = SnowFlake.terminal_columns end else sf.x += 1 if sf.x > SnowFlake.terminal_columns sf.x = 1 end end sf.y += 1 sf.y > SnowFlake.terminal_lines end new_snowflakes.times do flakes << SnowFlake.new(rand(1..SnowFlake.terminal_columns), 1) end print(*flakes) sleep sleep_duration rescue Interrupt exit end term-ansicolor-1.11.3/bin/term_cdiff0000755000004100000410000000047215062753465017403 0ustar www-datawww-data#!/usr/bin/env ruby # ## Little unix filter that colorizes diff output. # require 'term/ansicolor' include Term::ANSIColor ARGF.each do |line| STDOUT.print( case line when /^\+/ then green { line } when /^-/ then red { line } when /^(@@|diff)/ then blue { line } else line end ) end term-ansicolor-1.11.3/bin/term_mandel0000755000004100000410000000252515062753465017571 0ustar www-datawww-data#!/usr/bin/env ruby require 'term/ansicolor' include Term::ANSIColor require 'tins/xt' include Tins::GO require "complex" $width, $height = Tins::Terminal.cols, Tins::Terminal.lines $height *= 2 def color_random (1..3).map { rand(255) } end def draw_set(rx, ry) sx = (rx.end - rx.begin).abs / $width sy = (ry.end - ry.begin).abs / $height steps = 16 color = (5.times.map { color_random } + [ 0, 0, 0 ]).map { Attribute[_1] } color = color[1..-1].inject(color[0,1]) { |c, x| c + c.last.gradient_to(x, steps:) } iters = color.size - 2 data = [ [] ] for j in 0...$height for i in 0...$width n, z_n = 0, Complex(0, 0) c = Complex(sx * i + rx.begin, sy * j + ry.begin) while n <= iters break if z_n.abs > 2 z_n = z_n ** 2 + c n += 1 end data.last << n end data << [] end screen = '' (0...$height).step(2) do |j| (0...$width).each do |i| screen << color(color[data[j][i]]) << on_color(color[data[j + 1][i]]) << ?▀ end end print move_home, screen, reset end opts = go 'x:y' Term::ANSIColor.true_coloring = ENV['COLORTERM'] =~ /\A(truecolor|24bit)\z/ rx = opts[?x].full? { |r| Range.new(*(r.split('..', 2).map(&:to_f))) } || (-2.0..1.0) ry = opts[?y].full? { |r| Range.new(*(r.split('..', 2).map(&:to_f))) } || (-1.0..1.0) draw_set rx, ry term-ansicolor-1.11.3/term-ansicolor.gemspec0000644000004100000410000000751015062753465021106 0ustar www-datawww-data# -*- encoding: utf-8 -*- # stub: term-ansicolor 1.11.3 ruby lib Gem::Specification.new do |s| s.name = "term-ansicolor".freeze s.version = "1.11.3".freeze s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Florian Frank".freeze] s.date = "1980-01-02" s.description = "This library uses ANSI escape sequences to control the attributes of terminal output".freeze s.email = "flori@ping.de".freeze s.executables = ["term_cdiff".freeze, "term_colortab".freeze, "term_decolor".freeze, "term_display".freeze, "term_mandel".freeze, "term_plasma".freeze, "term_snow".freeze] s.extra_rdoc_files = ["README.md".freeze, "lib/term/ansicolor.rb".freeze, "lib/term/ansicolor/attribute.rb".freeze, "lib/term/ansicolor/attribute/color256.rb".freeze, "lib/term/ansicolor/attribute/color8.rb".freeze, "lib/term/ansicolor/attribute/intense_color8.rb".freeze, "lib/term/ansicolor/attribute/text.rb".freeze, "lib/term/ansicolor/attribute/underline.rb".freeze, "lib/term/ansicolor/hsl_triple.rb".freeze, "lib/term/ansicolor/hyperlink.rb".freeze, "lib/term/ansicolor/movement.rb".freeze, "lib/term/ansicolor/ppm_reader.rb".freeze, "lib/term/ansicolor/rgb_color_metrics.rb".freeze, "lib/term/ansicolor/rgb_triple.rb".freeze, "lib/term/ansicolor/version.rb".freeze] s.files = ["CHANGES.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/term_cdiff".freeze, "bin/term_colortab".freeze, "bin/term_decolor".freeze, "bin/term_display".freeze, "bin/term_mandel".freeze, "bin/term_plasma".freeze, "bin/term_snow".freeze, "examples/example.rb".freeze, "examples/lambda-red-plain.ppm".freeze, "examples/lambda-red.png".freeze, "examples/lambda-red.ppm".freeze, "lib/term/ansicolor.rb".freeze, "lib/term/ansicolor/.keep".freeze, "lib/term/ansicolor/attribute.rb".freeze, "lib/term/ansicolor/attribute/color256.rb".freeze, "lib/term/ansicolor/attribute/color8.rb".freeze, "lib/term/ansicolor/attribute/intense_color8.rb".freeze, "lib/term/ansicolor/attribute/text.rb".freeze, "lib/term/ansicolor/attribute/underline.rb".freeze, "lib/term/ansicolor/hsl_triple.rb".freeze, "lib/term/ansicolor/hyperlink.rb".freeze, "lib/term/ansicolor/movement.rb".freeze, "lib/term/ansicolor/ppm_reader.rb".freeze, "lib/term/ansicolor/rgb_color_metrics.rb".freeze, "lib/term/ansicolor/rgb_triple.rb".freeze, "lib/term/ansicolor/version.rb".freeze, "term-ansicolor.gemspec".freeze, "tests/ansicolor_test.rb".freeze, "tests/attribute_test.rb".freeze, "tests/hsl_triple_test.rb".freeze, "tests/hyperlink_test.rb".freeze, "tests/ppm_reader_test.rb".freeze, "tests/rgb_color_metrics_test.rb".freeze, "tests/rgb_triple_test.rb".freeze, "tests/test_helper.rb".freeze] s.homepage = "https://github.com/flori/term-ansicolor".freeze s.licenses = ["Apache-2.0".freeze] s.rdoc_options = ["--title".freeze, "Term-ansicolor - Ruby library that colors strings using ANSI escape sequences".freeze, "--main".freeze, "README.md".freeze] s.rubygems_version = "3.6.9".freeze s.summary = "Ruby library that colors strings using ANSI escape sequences".freeze s.test_files = ["tests/ansicolor_test.rb".freeze, "tests/attribute_test.rb".freeze, "tests/hsl_triple_test.rb".freeze, "tests/hyperlink_test.rb".freeze, "tests/ppm_reader_test.rb".freeze, "tests/rgb_color_metrics_test.rb".freeze, "tests/rgb_triple_test.rb".freeze, "tests/test_helper.rb".freeze] s.specification_version = 4 s.add_development_dependency(%q.freeze, ["~> 2.4".freeze]) s.add_development_dependency(%q.freeze, [">= 0".freeze]) s.add_development_dependency(%q.freeze, [">= 0".freeze]) s.add_development_dependency(%q.freeze, [">= 0".freeze]) s.add_development_dependency(%q.freeze, ["~> 0.8".freeze]) s.add_runtime_dependency(%q.freeze, ["~> 1".freeze]) end term-ansicolor-1.11.3/CHANGES.md0000644000004100000410000001516115062753465016176 0ustar www-datawww-data# Changes ## 2025-09-11 v1.11.3 - Added `fail_fast: true` configuration option - Removed `ruby:3.0-alpine` from the images list - Changed `s.date` from **2024-09-13** to **1980-01-02** - Removed GitHub-specific files from ignore list - Removed binary file detection configuration - Updated Dockerfile and script to modernize dependencies and build process - Removed obsolete `CHANGES` file and updated gemspec to exclude it - Added `debug` and `all_images` as development dependencies - Added `CHANGES.md` to the list of files in term-ansicolor.gemspec - Used markdown for CHANGES file - Updated gemspec - Renamed license file - Removed superfluous require statement that fixes issue #41 ## 2024-08-04 v1.11.2 * Removed unnecessary `require` statement. ## 2024-08-01 v1.11.1 * **New Version Features** + The library now works with the `--enable-string-literal` option even on ancient Rubies. + A working URL has been added. + Development files are ignored when creating a package. ## 2024-08-01 v1.11.0 * **Significant Changes**: + Refactor `parse_row` method to use more concise syntax + Add memoized versions of `rgb_colors` for foreground and background colors, improving performance by reducing calculations required to find the nearest color for a given RGB value + Update term-ansicolor gemspec to use `gem_hadar` **1.16.1** + Use less map instead of other methods + Add new executable called `term_plasma` that draws a plasma effect on the console ## 2024-07-15 v1.10.4 * **Dependency Update**: * Updated dependency on `mize` gem from `>= 0` to `~> 0.5`. ## 2024-07-15 v1.10.3 * **Display Resolution**: Doubled the display resolution. * **Code Improvements**: Improved code and coverage. * **Documentation**: Added documentation for `term_snow` command. * **Math Operations**: Used clamp method. ## 2024-06-22 v1.10.2 * Increase compactibility with older Rubies: + Don't use new features + Allow testing on ancient Rubies ## 2024-06-22 v1.10.1 * **Color Treatment Change**: * Treat all direct colors the same. * **HTML Code Correction**: * Fix wrong HTML code. ## 2024-06-21 v1.10.0 * **New Features** + Add support for overline and underline with different types and colors. + Add some more codes for text. * **Improvements** + Remove ordering hack for ruby < 1.9 + Make grey color block more compact * **Refactoring** + Remove and use global config ## 2024-06-18 v1.9.0 * **New Features** + Add true color support + Add `.utilsrc` * **Bug Fixes** + Fix the wind (oops) * **Miscellaneous Changes** + Require `test_helper` + Ignore `errors.lst` ## 2024-04-14 v1.8.0 * **New Features** + Added support for hyperlinks + Updated Ruby version to 3.3 ## 2024-03-15 v1.7.2 * **New Version Features** + Use GitHub as homepage + Test compatibility with Ruby 3.2.0 + Do not require Ruby, it's broken sometimes (development dependency removed) + Update CI/CD to use All Images instead of Travis ## 2019-01-18 v1.7.1 * Fix `term_display` command for never tins ## 2018-11-02 v1.7.0 * Add movement commands and `term_snow` executable ## 2017-04-13 v1.6.0 * Implement HSL colors and methods based on that code ## 2017-03-28 v1.5.0 * Change to Apache 2.0 license * **New Features** + Implemented HSL (Hue, Saturation, Lightness) color support + Added several new methods for working with colors ## 2017-03-24 v1.4.1 * Correct triple html color support ## 2016-09-27 v1.4.0 * Extend colorized strings with Term::ANSIColor ## 2015-06-23 v1.3.2 * Fixed issues from previous 1.3.1 release ## 2015-06-17 v1.3.1 * This release was a bit premature, yanked it. ## 2014-02-06 v1.3.0 * Support bright and faint color names. ## 2013-05-30 v1.2.2 * No more fun and smileys, now you have to call `term_display` yourself. * `term_display` can now display image URLs directly. ## 2013-05-24 v1.2.1 * Merge patch from Gavin Kistner to prevent warnings when running in -w mode. ## 2013-05-16 v1.2.0 * Add `term_mandel` and `term_display` executables. * Implement configurable color metrics. * Add gradient functionality for color attributes. ## 2013-04-18 v1.1.5 * Added `colortab` gem to RubyGems path. ## 2013-03-26 v1.1.4 * Easier access to color attributes via color(123) or approximate html colors like color('#336caf'). ## 2013-03-26 v1.1.3 * Fix a bug where `respond_to` could overflow the stack. ## 2013-03-26 v1.1.2 * Change the API: color0 - color255 to color(:color0) - color(:color255), and `on_color0` to `on_color(:color0)` - `on_color(:color255)`; the previous way caused some failures, sorry. On the plus side you can now do color('#4a6ab4') and get the nearest terminal color to this html color. * Add colortab executable to display the 255 colors and related HTML colors. ## 2013-03-08 v1.1.1 * Avoid possible conflicts with other people's attributes methods. * Cache attributes globally, also fix caching for frozen strings. ## 2013-03-07 v1.1.0 * Cleanup documentation. * Implement `color0` - `color255` and `on_color0` - `on_color255` methods for xterm256 colors. ## 2011-10-19 v1.0.8 * **Changes in Documentation** + Updated CHANGES file + Cleaned up documentation ## 2011-10-13 v1.0.7 * Merged patch by Mike Bethany that adds high intensity colors and backgrounds. * Fix problem caused by Ruby 1.9 implementing String#clear now, reported by Joe Fiorini . ## 2011-07-21 v1.0.6 * Use `gem_hadar` for Rakefile ## 2010-03-12 v1.0.5 * Added cdiff example as an executable. * Disabled building of gemspec file. * Made an decolor executable, that removes colors from an io stream. * Match an additional way to clear the color in the `COLORED_REGEXP` for the uncolored method. ## 2009-07-23 v1.0.4 * Some cleanup. * Build a gemspec file. ## 2007-10-05 v1.0.3 * Better documentation + some code clean up. * Deleted autorequire from Rakefile. ## 2005-11-12 v1.0.2 * Added DESTDIR in front of install path to make repackaging easier. Thanks to Tilman Sauerbeck for giving the hint. ## 2005-09-05 v1.0.1 * Fixed install bug in Rakefile, reported by Martin DeMello ## 2004-12-23 v1.0.0 * Added Term::ANSIColor.coloring[?=]? methods. Thanks, Thomas Husterer for the contribution. * Minor cleanup of code. * Documented visible methods in the module. ## 2004-09-28 v0.0.4 * First release on Rubyforge * Supports Rubygems now ## 2003-10-09 v0.0.3 * Added uncolored method as suggested by Thomas Husterer * Added attribute methods with string arguments * Deleted now unused files ## 2002-07-27 v0.0.2 * Minor Code Cleanup * Added cdiff.rb ## 2002-06-12 v0.0.1 * Start term-ansicolor-1.11.3/lib/0000755000004100000410000000000015062753465015346 5ustar www-datawww-dataterm-ansicolor-1.11.3/lib/term/0000755000004100000410000000000015062753465016315 5ustar www-datawww-dataterm-ansicolor-1.11.3/lib/term/ansicolor.rb0000644000004100000410000001022215062753465020630 0ustar www-datawww-datarequire 'tins/xt/full' require 'tins/xt/ask_and_send' module Term # The ANSIColor module can be used for namespacing and mixed into your own # classes. module ANSIColor require 'term/ansicolor/version' require 'term/ansicolor/attribute' require 'term/ansicolor/rgb_triple' require 'term/ansicolor/hsl_triple' require 'term/ansicolor/ppm_reader' require 'term/ansicolor/attribute/text' require 'term/ansicolor/attribute/color8' require 'term/ansicolor/attribute/intense_color8' require 'term/ansicolor/attribute/color256' require 'term/ansicolor/movement' include Term::ANSIColor::Movement require 'term/ansicolor/hyperlink' include Term::ANSIColor::Hyperlink include Term::ANSIColor::Attribute::Underline # Returns true, if the coloring function of this module # is switched on, false otherwise. def self.coloring? @coloring end # Turns the coloring on or off globally, so you can easily do # this for example: # Term::ANSIColor::coloring = STDOUT.isatty def self.coloring=(val) @coloring = !!val end self.coloring = true # Returns true, if the tue coloring mode of this module is switched on, # false otherwise. def self.true_coloring? @true_coloring end # Turns the true coloring mode on or off globally, that will display 24-bit # colors if your terminal supports it: # Term::ANSIColor::true_coloring = ENV['COLORTERM'] =~ /\A(truecolor|24bit)\z/ def self.true_coloring=(val) @true_coloring = !!val end self.true_coloring = false # Regular expression that is used to scan for ANSI-Attributes while # uncoloring strings. COLORED_REGEXP = /\e\[(?:(?:[349]|10)[0-7]|[0-9]|[34]8;(5;\d{1,3}|2;\d{1,3}(;\d{1,3}){2})|4:\d|53)?m/ # Returns an uncolored version of the string, that is all ANSI-Attributes # are stripped from the string. def uncolor(string = nil) # :yields: if block_given? yield.to_str.gsub(COLORED_REGEXP, '') elsif string.respond_to?(:to_str) string.to_str.gsub(COLORED_REGEXP, '') elsif respond_to?(:to_str) to_str.gsub(COLORED_REGEXP, '') else ''.dup end.extend(Term::ANSIColor) end alias uncolored uncolor def apply_code(code, string = nil, &block) result = ''.dup result << "\e[#{code}m" if Term::ANSIColor.coloring? if block_given? result << yield.to_s elsif string.respond_to?(:to_str) result << string.to_str elsif respond_to?(:to_str) result << to_str else return result # only switch on end result << "\e[0m" if Term::ANSIColor.coloring? result.extend(Term::ANSIColor) end def apply_attribute(name, string = nil, &block) attribute = Attribute[name] or raise ArgumentError, "unknown attribute #{name.inspect}" apply_code(attribute.code, string, &block) end # Return +string+ or the result string of the given +block+ colored with # color +name+. If string isn't a string only the escape sequence to switch # on the color +name+ is returned. def color(name, string = nil, &block) apply_attribute(name, string, &block) end # Return +string+ or the result string of the given +block+ with a # background colored with color +name+. If string isn't a string only the # escape sequence to switch on the color +name+ is returned. def on_color(name, string = nil, &block) attribute = Attribute[name] or raise ArgumentError, "unknown attribute #{name.inspect}" attribute = attribute.dup attribute.background = true apply_attribute(attribute, string, &block) end class << self # Returns an array of all Term::ANSIColor attributes as symbols. def term_ansicolor_attributes ::Term::ANSIColor::Attribute.attributes.map(&:name) end alias attributes term_ansicolor_attributes end # Returns an array of all Term::ANSIColor attributes as symbols. def term_ansicolor_attributes ::Term::ANSIColor.term_ansicolor_attributes end alias attributes term_ansicolor_attributes extend self end end term-ansicolor-1.11.3/lib/term/ansicolor/0000755000004100000410000000000015062753465020306 5ustar www-datawww-dataterm-ansicolor-1.11.3/lib/term/ansicolor/hyperlink.rb0000644000004100000410000000166515062753465022650 0ustar www-datawww-datarequire 'tins/terminal' module Term module ANSIColor module Hyperlink def hyperlink(link, string = nil, id: nil, as_link: false) block_given? && string != nil && !respond_to?(:to_str) and raise ArgumentError, "Require either the string argument or a block argument" if link.nil? link = '' end if as_link && !link.empty? string ||= link end result = '' if Term::ANSIColor.coloring? result = "\e]8;#{"id=#{id}" unless id.nil?};".dup << link.to_str << "\e\\" end if block_given? result << yield.to_s elsif string.respond_to?(:to_str) result << string.to_str elsif respond_to?(:to_str) result << to_str else return result # only switch on end result << "\e]8;;\e\\" if Term::ANSIColor.coloring? result end end end end term-ansicolor-1.11.3/lib/term/ansicolor/hsl_triple.rb0000644000004100000410000001036315062753465023003 0ustar www-datawww-datamodule Term module ANSIColor class HSLTriple def self.from_rgb_triple(rgb) ps = [ rgb.red / 255.0, rgb.green / 255.0, rgb.blue / 255.0 ] p_min = ps.min p_max = ps.max p_red, p_green, p_blue = ps diff = p_max - p_min l = (p_max + p_min) / 2 if diff.zero? h = s = 0.0 else if l < 0.5 s = diff / (p_max + p_min) else s = diff / (2 - p_max - p_min) end diff_r = ( ( ( p_max - p_red ) / 6 ) + ( diff / 2 ) ) / diff diff_g = ( ( ( p_max - p_green ) / 6 ) + ( diff / 2 ) ) / diff diff_b = ( ( ( p_max - p_blue ) / 6 ) + ( diff / 2 ) ) / diff h = case p_max when p_red diff_b - diff_g when p_green (1 / 3.0) + diff_r - diff_b when p_blue (2 / 3.0) + diff_g - diff_r end h < 0 and h += 1 h > 1 and h -= 1 end from_hash( hue: 360 * h, saturation: 100 * s, lightness: 100 * l ) end def self.from_css(css) case css when /\A\s*hsl\(\s*([^,\s]+)\s*,\s*([^%\s]+)\s*%\s*,\s*([^%\s]+)\s*%\s*\)\z/ new(Float($1), Float($2), Float($3)) end end def self.from_hash(options) new( options[:hue].to_f, options[:saturation].to_f, options[:lightness].to_f ) end def self.[](thing) case when thing.respond_to?(:to_hsl_triple) then thing.to_hsl_triple when thing.respond_to?(:to_hash) then from_hash(thing.to_hash) when thing.respond_to?(:to_str) thing = thing.to_str from_css(thing.to_str) || Term::ANSIColor::RGBTriple.from_html(thing).full?(:to_hsl_triple) || Term::ANSIColor::RGBTriple.from_css(thing).full?(:to_hsl_triple) else raise ArgumentError, "cannot convert #{thing.inspect} into #{self}" end end def initialize(hue, saturation, lightness) @hue = Float(hue) % 360 @saturation = Float(saturation).clamp(0, 100) @lightness = Float(lightness).clamp(0, 100) end attr_reader :hue attr_reader :saturation attr_reader :lightness def lighten(percentage) self.class.new(@hue, @saturation, @lightness + percentage) end def darken(percentage) self.class.new(@hue, @saturation, @lightness - percentage) end def saturate(percentage) self.class.new(@hue, @saturation + percentage, @lightness) end def desaturate(percentage) self.class.new(@hue, @saturation - percentage, @lightness) end def adjust_hue(degree) self.class.new(@hue + degree, @saturation, @lightness) end def grayscale self.class.new(@hue, 0, @lightness) end def complement adjust_hue(180) end def hue2rgb(x, y, h) h < 0 and h += 1 h > 1 and h -= 1 (6 * h) < 1 and return x + (y - x) * 6 * h (2 * h) < 1 and return y (3 * h) < 2 and return x + (y - x) * ( (2 / 3.0) - h ) * 6 x end private :hue2rgb def to_rgb_triple h = @hue / 360.0 s = @saturation / 100.0 l = @lightness / 100.0 if s.zero? r = 255 * l g = 255 * l b = 255 * l else if l < 0.5 y = l * (1 + s) else y = (l + s) - (s * l) end x = 2 * l - y r = 255 * hue2rgb(x, y, h + (1 / 3.0)) g = 255 * hue2rgb(x, y, h) b = 255 * hue2rgb(x, y, h - (1 / 3.0)) end Term::ANSIColor::RGBTriple.new(r.round, g.round, b.round) end def to_hsl_triple self end def css "hsl(%s,%s%%,%s%%)" % [ @hue, @saturation, @lightness ] end def ==(other) to_rgb_triple == other.to_rgb_triple end def method_missing(name, *args, &block) if Term::ANSIColor::RGBTriple.method_defined?(name) to_rgb_triple.send(name, *args, &block) else super end end end end end term-ansicolor-1.11.3/lib/term/ansicolor/ppm_reader.rb0000644000004100000410000000414515062753465022755 0ustar www-datawww-datamodule Term module ANSIColor class PPMReader include Term::ANSIColor def initialize(io, options = {}) @io = io @options = options @buffer = ''.dup if options[:true_coloring] @color = -> pixel { on_color Attribute.true_color(pixel, @options) } else @color = -> pixel { on_color Attribute.nearest_rgb_color(pixel, @options) } end end def reset_io begin @io.rewind rescue Errno::ESPIPE end parse_header end def rows reset_io Enumerator.new do |yielder| @height.times do yielder.yield parse_row end end end def to_a rows.to_a end def to_s rows.map do |row| last_pixel = nil row.map do |pixel| if pixel != last_pixel last_pixel = pixel @color.(pixel) << ' ' else ' ' end end.join << reset << ?\n end.join end private def parse_row @width.times.map { parse_next_pixel } end def parse_next_pixel pixel = nil case @type when 3 @buffer.empty? and @buffer << next_line @buffer.sub!(/(\d+)\s+(\d+)\s+(\d+)\s*/) do pixel = [ $1.to_i, $2.to_i, $3.to_i ] '' end when 6 @buffer.size < 3 and @buffer << @io.read(8192) pixel = @buffer.slice!(0, 3).unpack('C3') end pixel end def parse_header (line = next_line) =~ /^P([36])$/ or raise "unknown type #{line.to_s.chomp.inspect}" @type = $1.to_i if next_line =~ /^(\d+)\s+(\d+)$/ @width, @height = $1.to_i, $2.to_i else raise "missing dimensions" end unless next_line =~ /^255$/ raise "only 255 max color images allowed" end end def next_line while line = @io.gets and line =~ /^#|^\s$/ end line end end end end term-ansicolor-1.11.3/lib/term/ansicolor/rgb_color_metrics.rb0000644000004100000410000001110615062753465024330 0ustar www-datawww-datamodule Term module ANSIColor module RGBColorMetricsHelpers module WeightedEuclideanDistance def weighted_euclidean_distance_to(other, weights = [ 1.0 ] * values.size) sum = 0.0 values.zip(other.values, weights) do |s, o, w| sum += w * (s - o) ** 2 end Math.sqrt(sum) end end module NormalizeRGBTriple private def normalize(v) v /= 255.0 if v <= 0.04045 v / 12 else ( (v + 0.055) / 1.055 ) ** 2.4 end end def normalize_rgb_triple(rgb_triple) [ normalize(rgb_triple.red), normalize(rgb_triple.green), normalize(rgb_triple.blue), ] end end end module RGBColorMetrics def self.metric(name) metric?(name) or raise ArgumentError, "unknown metric #{name.inspect}" end def self.metric?(name) if const_defined?(name) const_get name end end def self.metrics constants.map(&:to_sym) end # Implements color distance how the old greeks and most donkeys would… module Euclidean def self.distance(rgb1, rgb2) rgb1.weighted_euclidean_distance_to rgb2 end end # Implements color distance the best way everybody knows… module NTSC def self.distance(rgb1, rgb2) rgb1.weighted_euclidean_distance_to rgb2, [ 0.299, 0.587, 0.114 ] end end # Implements color distance as given in: # http://www.compuphase.com/cmetric.htm module CompuPhase def self.distance(rgb1, rgb2) rmean = (rgb1.red + rgb2.red) / 2 rgb1.weighted_euclidean_distance_to rgb2, [ 2 + (rmean >> 8), 4, 2 + ((255 - rmean) >> 8) ] end end module YUV class YUVTriple < Struct.new(:y, :u, :v) include RGBColorMetricsHelpers::WeightedEuclideanDistance def self.from_rgb_triple(rgb_triple) r, g, b = rgb_triple.red, rgb_triple.green, rgb_triple.blue y = (0.299 * r + 0.587 * g + 0.114 * b).round u = ((b - y) * 0.492).round v = ((r - y) * 0.877).round new(y, u, v) end end def self.distance(rgb1, rgb2) yuv1 = YUVTriple.from_rgb_triple(rgb1) yuv2 = YUVTriple.from_rgb_triple(rgb2) yuv1.weighted_euclidean_distance_to yuv2 end end module CIEXYZ class CIEXYZTriple < Struct.new(:x, :y, :z) include RGBColorMetricsHelpers::WeightedEuclideanDistance extend RGBColorMetricsHelpers::NormalizeRGBTriple def self.from_rgb_triple(rgb_triple) r, g, b = normalize_rgb_triple rgb_triple x = 0.436052025 * r + 0.385081593 * g + 0.143087414 * b y = 0.222491598 * r + 0.71688606 * g + 0.060621486 * b z = 0.013929122 * r + 0.097097002 * g + 0.71418547 * b x *= 255 y *= 255 z *= 255 new(x.round, y.round, z.round) end end def self.distance(rgb1, rgb2) xyz1 = CIEXYZTriple.from_rgb_triple(rgb1) xyz2 = CIEXYZTriple.from_rgb_triple(rgb2) xyz1.weighted_euclidean_distance_to xyz2 end end module CIELab class CIELabTriple < Struct.new(:l, :a, :b) include RGBColorMetricsHelpers::WeightedEuclideanDistance extend RGBColorMetricsHelpers::NormalizeRGBTriple def self.from_rgb_triple(rgb_triple) r, g, b = normalize_rgb_triple rgb_triple x = 0.436052025 * r + 0.385081593 * g + 0.143087414 * b y = 0.222491598 * r + 0.71688606 * g + 0.060621486 * b z = 0.013929122 * r + 0.097097002 * g + 0.71418547 * b xr = x / 0.964221 yr = y zr = z / 0.825211 eps = 216.0 / 24389 k = 24389.0 / 27 fx = xr > eps ? xr ** (1.0 / 3) : (k * xr + 16) / 116 fy = yr > eps ? yr ** (1.0 / 3) : (k * yr + 16) / 116 fz = zr > eps ? zr ** (1.0 / 3) : (k * zr + 16) / 116 l = 2.55 * ((116 * fy) - 16) a = 500 * (fx - fy) b = 200 * (fy - fz) new(l.round, a.round, b.round) end end def self.distance(rgb1, rgb2) lab1 = CIELabTriple.from_rgb_triple(rgb1) lab2 = CIELabTriple.from_rgb_triple(rgb2) lab1.weighted_euclidean_distance_to lab2 end end end end end term-ansicolor-1.11.3/lib/term/ansicolor/.keep0000644000004100000410000000000015062753465021221 0ustar www-datawww-dataterm-ansicolor-1.11.3/lib/term/ansicolor/version.rb0000644000004100000410000000043615062753465022323 0ustar www-datawww-datamodule Term::ANSIColor # Term::ANSIColor version VERSION = '1.11.3' VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc: VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc: VERSION_MINOR = VERSION_ARRAY[1] # :nodoc: VERSION_BUILD = VERSION_ARRAY[2] # :nodoc: end term-ansicolor-1.11.3/lib/term/ansicolor/attribute/0000755000004100000410000000000015062753465022311 5ustar www-datawww-dataterm-ansicolor-1.11.3/lib/term/ansicolor/attribute/color8.rb0000644000004100000410000000173315062753465024050 0ustar www-datawww-datamodule Term module ANSIColor class Attribute class Color8 Attribute.set :black, 30, direct: '#000000' Attribute.set :red, 31, direct: '#800000' Attribute.set :green, 32, direct: '#008000' Attribute.set :yellow, 33, direct: '#808000' Attribute.set :blue, 34, direct: '#000080' Attribute.set :magenta, 35, direct: '#800080' Attribute.set :cyan, 36, direct: '#008080' Attribute.set :white, 37, direct: '#c0c0c0' Attribute.set :on_black, 40, direct: '#000000' Attribute.set :on_red, 41, direct: '#800000' Attribute.set :on_green, 42, direct: '#008000' Attribute.set :on_yellow, 43, direct: '#808000' Attribute.set :on_blue, 44, direct: '#000080' Attribute.set :on_magenta, 45, direct: '#800080' Attribute.set :on_cyan, 46, direct: '#008080' Attribute.set :on_white, 47, direct: '#808080' end end end end term-ansicolor-1.11.3/lib/term/ansicolor/attribute/text.rb0000644000004100000410000000211615062753465023622 0ustar www-datawww-datarequire 'term/ansicolor/attribute/underline' module Term module ANSIColor class Attribute class Text Attribute.set :clear, 0 # String#clear already used in String Attribute.set :reset, 0 # synonym for :clear Attribute.set :bold, 1 Attribute.set :dark, 2 Attribute.set :faint, 2 Attribute.set :italic, 3 # not widely implemented Attribute.set :blink, 5 Attribute.set :rapid_blink, 6 # not widely implemented Attribute.set :reverse, 7 # String#reverse already used in String Attribute.set :negative, 7 # synonym for :reverse Attribute.set :concealed, 8 Attribute.set :conceal, 8 # synonym for :concealed Attribute.set :strikethrough, 9 # not widely implemented Attribute.set :overline, 53 include Term::ANSIColor::Attribute::Underline end end end end term-ansicolor-1.11.3/lib/term/ansicolor/attribute/color256.rb0000644000004100000410000000562315062753465024217 0ustar www-datawww-datamodule Term module ANSIColor class Attribute class Color256 Attribute.set :color0, 0, html: '#000000' Attribute.set :color1, 1, html: '#800000' Attribute.set :color2, 2, html: '#008000' Attribute.set :color3, 3, html: '#808000' Attribute.set :color4, 4, html: '#000080' Attribute.set :color5, 5, html: '#800080' Attribute.set :color6, 6, html: '#008080' Attribute.set :color7, 7, html: '#c0c0c0' Attribute.set :color8, 8, html: '#808080' Attribute.set :color9, 9, html: '#ff0000' Attribute.set :color10, 10, html: '#00ff00' Attribute.set :color11, 11, html: '#ffff00' Attribute.set :color12, 12, html: '#0000ff' Attribute.set :color13, 13, html: '#ff00ff' Attribute.set :color14, 14, html: '#00ffff' Attribute.set :color15, 15, html: '#ffffff' steps = [ 0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff ] for i in 16..231 red, green, blue = (i - 16).to_s(6).rjust(3, '0').each_char.map { |c| steps[c.to_i] } Attribute.set "color#{i}", i, red: red, green: green, blue: blue end grey = 8 for i in 232..255 Attribute.set "color#{i}", i, red: grey, green: grey, blue: grey grey += 10 end Attribute.set :on_color0, 0, html: '#000000', background: true Attribute.set :on_color1, 1, html: '#800000', background: true Attribute.set :on_color2, 2, html: '#808000', background: true Attribute.set :on_color3, 3, html: '#808000', background: true Attribute.set :on_color4, 4, html: '#000080', background: true Attribute.set :on_color5, 5, html: '#800080', background: true Attribute.set :on_color6, 6, html: '#008080', background: true Attribute.set :on_color7, 7, html: '#c0c0c0', background: true Attribute.set :on_color8, 8, html: '#808080', background: true Attribute.set :on_color9, 9, html: '#ff0000', background: true Attribute.set :on_color10, 10, html: '#00ff00', background: true Attribute.set :on_color11, 11, html: '#ffff00', background: true Attribute.set :on_color12, 12, html: '#0000ff', background: true Attribute.set :on_color13, 13, html: '#ff00ff', background: true Attribute.set :on_color14, 14, html: '#00ffff', background: true Attribute.set :on_color15, 15, html: '#ffffff', background: true steps = [ 0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff ] for i in 16..231 red, green, blue = (i - 16).to_s(6).rjust(3, '0').each_char.map { |c| steps[c.to_i] } Attribute.set "on_color#{i}", i, red: red, green: green, blue: blue, background: true end grey = 8 for i in 232..255 Attribute.set "on_color#{i}", i, red: grey, green: grey, blue: grey, background: true grey += 10 end end end end end term-ansicolor-1.11.3/lib/term/ansicolor/attribute/underline.rb0000644000004100000410000000177715062753465024637 0ustar www-datawww-datamodule Term module ANSIColor class Attribute module Underline Attribute.set :underline, 4, skip_definition: true Attribute.set :underscore, 4, skip_definition: true # synonym for :underline def underline(string = nil, color: nil, type: nil, &block) code = { nil => 4, default: '4:1', double: '4:2', curly: '4:3', dotted: '4:4', dashed: '4:5', }.fetch(type) { raise ArgumentError, "invalid line type" } if color a = Term::ANSIColor::Attribute[color] color_code = if rgb = a.ask_and_send(:to_rgb_triple).full?(:to_a) "\e[58;2;#{rgb * ?;}" else raise ArgumentError, "invalid color #{a&.name.inspect}" end code = "#{code}m#{color_code}" end apply_code(code, string, &block) end alias underscore underline end end end end term-ansicolor-1.11.3/lib/term/ansicolor/attribute/intense_color8.rb0000644000004100000410000000415215062753465025573 0ustar www-datawww-datamodule Term module ANSIColor class Attribute class IntenseColor8 Attribute.set :intense_black, 90, direct: '#808080' Attribute.set :bright_black, 90, direct: '#808080' Attribute.set :intense_red, 91, direct: '#ff0000' Attribute.set :bright_red, 91, direct: '#ff0000' Attribute.set :intense_green, 92, direct: '#00ff00' Attribute.set :bright_green, 92, direct: '#00ff00' Attribute.set :intense_yellow, 93, direct: '#ffff00' Attribute.set :bright_yellow, 93, direct: '#ffff00' Attribute.set :intense_blue, 94, direct: '#0000ff' Attribute.set :bright_blue, 94, direct: '#0000ff' Attribute.set :intense_magenta, 95, direct: '#ff00ff' Attribute.set :bright_magenta, 95, direct: '#ff00ff' Attribute.set :intense_cyan, 96, direct: '#00ffff' Attribute.set :bright_cyan, 96, direct: '#00ffff' Attribute.set :intense_white, 97, direct: '#ffffff' Attribute.set :bright_white, 97, direct: '#ffffff' Attribute.set :on_intense_black, 100, direct: '#808080' Attribute.set :on_bright_black, 100, direct: '#808080' Attribute.set :on_intense_red, 101, direct: '#ff0000' Attribute.set :on_bright_red, 101, direct: '#ff0000' Attribute.set :on_intense_green, 102, direct: '#00ff00' Attribute.set :on_bright_green, 102, direct: '#00ff00' Attribute.set :on_intense_yellow, 103, direct: '#ffff00' Attribute.set :on_bright_yellow, 103, direct: '#ffff00' Attribute.set :on_intense_blue, 104, direct: '#0000ff' Attribute.set :on_bright_blue, 104, direct: '#0000ff' Attribute.set :on_intense_magenta, 105, direct: '#ff00ff' Attribute.set :on_bright_magenta, 105, direct: '#ff00ff' Attribute.set :on_intense_cyan, 106, direct: '#00ffff' Attribute.set :on_bright_cyan, 106, direct: '#00ffff' Attribute.set :on_intense_white, 107, direct: '#ffffff' Attribute.set :on_bright_white, 107, direct: '#ffffff' end end end end term-ansicolor-1.11.3/lib/term/ansicolor/movement.rb0000644000004100000410000000552515062753465022474 0ustar www-datawww-datarequire 'tins/terminal' module Term module ANSIColor module Movement def terminal_lines Tins::Terminal.lines end def terminal_columns Tins::Terminal.columns end def move_to(line = 1, column = 1, string = nil, &block) move_command("\e[#{line.to_i};#{column.to_i}H", string, &block) end def move_to_column(column = 1, string = nil, &block) move_command("\e[#{column.to_i}G", string, &block) end def move_to_line(line = 1, string = nil, &block) move_command("\e[#{line.to_i}f", string, &block) end def move_up(lines = 1, string = nil, &block) move_command("\e[#{lines.to_i}A", string, &block) end def move_down(lines = 1, string = nil, &block) move_command("\e[#{lines.to_i}B", string, &block) end def move_forward(columns = 1, string = nil, &block) move_command("\e[#{columns.to_i}C", string, &block) end def move_backward(columns = 1, string = nil, &block) move_command("\e[#{columns.to_i}D", string, &block) end def move_to_next_line(lines = 1, string = nil, &block) move_command("\e[#{lines}E", string, &block) end def move_to_previous_line(lines = 1, string = nil, &block) move_command("\e[#{lines}F", string, &block) end def move_home(string = nil, &block) move_to(1, 1, string, &block) end def clear_screen(string = nil, &block) erase_in_display(2, string, &block) end def erase_in_display(n = 0, string = nil, &block) move_command("\e[#{n}J", string, &block) end def erase_in_line(n = 0, string = nil, &block) move_command("\e[#{n}K", string, &block) end def scroll_up(pages = 1, string = nil, &block) move_command("\e[#{pages}S", string, &block) end def scroll_down(pages = 1, string = nil, &block) move_command("\e[#{pages}T", string, &block) end def save_position(string = nil, &block) move_command("\e[s", string, &block) end def restore_position(string = nil, &block) move_command("\e[u", string, &block) end def return_to_position(string = nil, &block) save_position("") << move_command("", string, &block) << restore_position("") end def show_cursor(string = nil, &block) move_command("\e[?25h", string, &block) end def hide_cursor(string = nil, &block) move_command("\e[?25l", string, &block) end private def move_command(move, string = nil) move = move.dup if block_given? move << yield.to_s elsif string.respond_to?(:to_str) move << string.to_str elsif respond_to?(:to_str) move << to_str end move end end end end term-ansicolor-1.11.3/lib/term/ansicolor/rgb_triple.rb0000644000004100000410000001064715062753465022774 0ustar www-datawww-datarequire 'term/ansicolor/rgb_color_metrics' module Term module ANSIColor class RGBTriple include Term::ANSIColor::RGBColorMetricsHelpers::WeightedEuclideanDistance def self.convert_value(color, max: 255) color.nil? and raise ArgumentError, "missing color value" color = Integer(color) (0..max) === color or raise ArgumentError, "color value #{color.inspect} not between 0 and #{max}" color end private_class_method :convert_value def self.from_html(html) case html when /\A#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})\z/i new(*$~.captures.map { |c| convert_value(c.to_i(16)) }) when /\A#([0-9a-f])([0-9a-f])([0-9a-f])\z/i new(*$~.captures.map { |c| convert_value((c + c).to_i(16)) }) end end def self.from_css(css) case css when /\A\s*rgb\(\s*([^%\s]+)\s*%\s*,\s*([^%\s]+)\s*%\s*,\s*([^%\s]+)\s*%\s*\)\z/ new(*$~.captures.map { |c| convert_value(((Float(c) / 100) * 0xff).round) }) when /\A\s*rgb\(\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^\)\s]+)\s*\)\z/ new(*$~.captures.map { |c| convert_value((Float(c)).round) }) end end def self.from_hash(options) new( convert_value(options[:red]), convert_value(options[:green]), convert_value(options[:blue]) ) end def self.from_array(array) new(*array) end def self.[](thing) case when thing.respond_to?(:to_rgb_triple) then thing.to_rgb_triple when thing.respond_to?(:to_ary) then from_array(thing.to_ary) when thing.respond_to?(:to_str) thing = thing.to_str from_html(thing.sub(/\Aon_/, '')) || from_css(thing) || Term::ANSIColor::HSLTriple.from_css(thing).full?(:to_rgb_triple) when thing.respond_to?(:to_hash) then from_hash(thing.to_hash) else raise ArgumentError, "cannot convert #{thing.inspect} into #{self}" end end def initialize(red, green, blue) @values = [ red.clamp(0, 0xff), green.clamp(0, 0xff), blue.clamp(0, 0xff), ] end def red @values[0] end def green @values[1] end def blue @values[2] end def percentages @percentages ||= @values.map { |v| 100 * v / 255.0 } end def red_p percentages[0] end def green_p percentages[1] end def blue_p percentages[2] end def invert self.class.new(255 - red, 255 - green, 255 - blue) end def gray? red != 0 && red != 0xff && red == green && green == blue && blue == red end def html '#%02x%02x%02x' % @values end def css(percentage: false) if percentage "rgb(%s%%,%s%%,%s%%)" % percentages else "rgb(%u,%u,%u)" % @values end end def to_rgb_triple self end def to_hsl_triple Term::ANSIColor::HSLTriple.from_rgb_triple(self) end attr_reader :values protected :values def to_a @values.dup end def ==(other) @values == other.to_rgb_triple.values end def color(string) Term::ANSIColor.color(self, string) end def distance_to(other, options = {}) options[:metric] ||= RGBColorMetrics::CIELab options[:metric].distance(self, other) end def initialize_copy(other) r = super other.instance_variable_set :@values, @values.dup r end def gradient_to(other, options = {}) options[:steps] ||= 16 steps = options[:steps].to_i steps < 2 and raise ArgumentError, 'at least 2 steps are required' changes = other.values.zip(@values).map { |x, y| x - y } current = self gradient = [ current.dup ] s = steps - 1 while s > 1 current = current.dup gradient << current 3.times do |i| current.values[i] += changes[i] / (steps - 1) end s -= 1 end gradient << other end def method_missing(name, *args, &block) if Term::ANSIColor::HSLTriple.method_defined?(name) to_hsl_triple.send(name, *args, &block) else super end end end end end term-ansicolor-1.11.3/lib/term/ansicolor/attribute.rb0000644000004100000410000001324015062753465022636 0ustar www-datawww-datamodule Term module ANSIColor class Attribute @__store__ = {} def self.set(name, code, **options) name = name.to_sym result = @__store__[name] = new(name, code, options) unless options[:skip_definition] ::Term::ANSIColor.class_eval do define_method(name) do |string = nil, &block| apply_attribute(name, string, &block) end end end result end def self.attributes(&block) @__store__.each_value(&block) end def self.[](name, true_coloring: false) true_coloring ||= Term::ANSIColor.true_coloring? if true_coloring case when self === name then name when Array === name then true_color name when name.respond_to?(:to_rgb_triple) then true_color(name.to_rgb_triple.to_a) when name.to_s =~ /\A(on_)?(\d+)\z/ then get "#$1color#$2" when name.to_s =~ /\A#([0-9a-f]{3}){1,2}\z/i then true_color name when name.to_s =~ /\Aon_#([0-9a-f]{3}){1,2}\z/i then on_true_color name else get name end else case when self === name then name when Array === name then nearest_rgb_color name when name.respond_to?(:to_rgb_triple) then nearest_rgb_color(name.to_rgb_triple.to_a) when name.to_s =~ /\A(on_)?(\d+)\z/ then get "#$1color#$2" when name.to_s =~ /\A#([0-9a-f]{3}){1,2}\z/i then nearest_rgb_color name when name.to_s =~ /\Aon_#([0-9a-f]{3}){1,2}\z/i then nearest_rgb_on_color name else get name end end end def self.get(name) @__store__[name.to_sym] end class << self def rgb_colors(options = {}, &block) colors = attributes.select(&:rgb_color?) if options.key?(:gray) && !options[:gray] colors = colors.reject(&:gray?) end colors.each(&block) end def rgb_foreground_colors(options = {}, &block) rgb_colors(options).reject(&:background?).each(&block) end def rgb_background_colors(options = {}, &block) rgb_colors(options).select(&:background?).each(&block) end end def self.named_attributes(&block) @named_attributes ||= attributes.reject(&:rgb_color?).each(&block) end def self.nearest_rgb_color(color, options = {}) rgb = RGBTriple[color] rgb_foreground_colors(options).min_by { |c| c.distance_to(rgb, options) } end def self.nearest_rgb_on_color(color, options = {}) rgb = RGBTriple[color] rgb_background_colors(options).min_by { |c| c.distance_to(rgb, options) } end def self.true_color(color, options = {}) rgb = RGBTriple[color] new(:true, "", { true_color: rgb, background: false }) end def self.on_true_color(color, options = {}) rgb = RGBTriple[color] new(:on_true, "", { true_color: rgb, background: true }) end def initialize(name, code, options = {}) @name = name.to_sym @background = !!options[:background] @code = code.to_s @direct = false @true_color = false if rgb = options[:true_color] @true_color = true @rgb = rgb elsif rgb = options[:direct] @direct = true @rgb = RGBTriple.from_html(rgb) elsif html = options[:html] @rgb = RGBTriple.from_html(html) elsif options.slice(:red, :green, :blue).size == 3 @rgb = RGBTriple.from_hash(options) else @rgb = nil # prevent instance variable not initialized warnings end end attr_reader :name def code if true_color? background? ? "48;2;#{@rgb.to_a * ?;}" : "38;2;#{@rgb.to_a * ?;}" elsif rgb_color? background? ? "48;5;#{@code}" : "38;5;#{@code}" elsif direct? background? ? (@code.to_i + 10).to_s : @code else @code end end def apply(string = nil, &block) ::Term::ANSIColor.apply_attribute(self, string, &block) end def background? !!@background end def direct? !!@direct end attr_writer :background attr_reader :rgb def rgb_color? !!@rgb && !@true_color && !@direct end def true_color? !!(@rgb && @true_color) end def gray? rgb_color? && to_rgb_triple.gray? end def to_rgb_triple @rgb end def distance_to(other, options = {}) if our_rgb = to_rgb_triple and other.respond_to?(:to_rgb_triple) and other_rgb = other.to_rgb_triple then our_rgb.distance_to(other_rgb, options) else 1 / 0.0 end end def gradient_to(other, options = {}) if our_rgb = to_rgb_triple and other.respond_to?(:to_rgb_triple) and other_rgb = other.to_rgb_triple then true_coloring = options[:true_coloring] || Term::ANSIColor.true_coloring? our_rgb.gradient_to(other_rgb, options).map do |rgb_triple| if true_coloring self.class.true_color(rgb_triple, options) else self.class.nearest_rgb_color(rgb_triple, options) end end else [] end end end end end term-ansicolor-1.11.3/tests/0000755000004100000410000000000015062753465015742 5ustar www-datawww-dataterm-ansicolor-1.11.3/tests/test_helper.rb0000644000004100000410000000014515062753465020605 0ustar www-datawww-datarequire 'gem_hadar/simplecov' GemHadar::SimpleCov.start require 'test/unit' require 'term/ansicolor' term-ansicolor-1.11.3/tests/hsl_triple_test.rb0000644000004100000410000000540615062753465021500 0ustar www-datawww-datarequire 'test_helper' class HSLTripleTest < Test::Unit::TestCase include Term::ANSIColor def setup @pastel_green_rgb = Term::ANSIColor::RGBTriple['#85e085'] @pastel_green_hsl = Term::ANSIColor::HSLTriple.new(120, 59.4, 70) @soft_red_rgb = Term::ANSIColor::RGBTriple['#e08585'] @soft_blue_rgb = Term::ANSIColor::RGBTriple['#8585e0'] @gray_rgb = Term::ANSIColor::RGBTriple['#888'] end def test_hsl_cast assert_equal '#85e085', HSLTriple[ @pastel_green_hsl ].html assert_equal '#85e085', HSLTriple[ hue: 120, saturation: 59.4, lightness: 70 ].html assert_equal '#11ddff', HSLTriple[ '#1df' ].html assert_equal '#8000ff', HSLTriple[ 'rgb(128,0,255)' ].html assert_equal '#85e085', HSLTriple[ 'hsl(120.0,59.4%,70.0%)' ].html assert_raises ArgumentError do HSLTriple[ nil ] end end def test_conversion_to_hsl hsl = @pastel_green_rgb.to_hsl_triple assert_in_delta @pastel_green_hsl.hue, hsl.hue, 1e-1 assert_in_delta @pastel_green_hsl.saturation, hsl.saturation, 1e-1 assert_in_delta @pastel_green_hsl.lightness, hsl.lightness, 1e-1 assert_match(/hsl\(0\.0,0\.0%,53.3333.*?%\)/, @gray_rgb.to_hsl_triple.css) assert_match(/hsl\(120\.0.*?,58\.82.*?%,20.0%\)/, RGBTriple[ '#155115' ].to_hsl_triple.css) end def test_conversion_to_rgb rgb = @pastel_green_hsl.to_rgb_triple assert_in_delta @pastel_green_rgb.red, rgb.red, 1e-1 assert_in_delta @pastel_green_rgb.green, rgb.green, 1e-1 assert_in_delta @pastel_green_rgb.blue, rgb.blue, 1e-1 assert_equal '#155115', HSLTriple[ '#155115' ].to_rgb_triple.html end def test_lighten assert_in_delta 80, @pastel_green_hsl.lighten(10).lightness, 1e-3 end def test_darken assert_in_delta 60, @pastel_green_hsl.darken(10).lightness, 1e-3 end def test_saturate assert_in_delta 69.4, @pastel_green_hsl.saturate(10).saturation, 1e-3 end def test_desaturate assert_in_delta 49.4, @pastel_green_hsl.desaturate(10).saturation, 1e-3 end def test_adjust_hue assert_in_delta 130, @pastel_green_hsl.adjust_hue(10).hue, 1e-3 end def test_grayscale assert_equal '#b3b3b3', @pastel_green_hsl.grayscale.html end def test_complement assert_in_delta 300, @pastel_green_hsl.complement.hue, 1e-3 assert_in_delta 300 - 120, @soft_red_rgb.complement.hue, 1e-3 assert_in_delta 300 - 240, @soft_blue_rgb.complement.hue, 1e-3 end def test_css assert_equal 'hsl(120.0,59.4%,70.0%)', @pastel_green_hsl.css assert_equal '#85e085', HSLTriple.from_css('hsl(120.0,59.4%,70.0%)').html end def test_equality assert_equal @pastel_green_hsl, @pastel_green_rgb assert_equal @pastel_green_rgb, @pastel_green_hsl end def test_method_missing assert_raises(NoMethodError) { @pastel_green_hsl.foo } end end term-ansicolor-1.11.3/tests/attribute_test.rb0000644000004100000410000001035515062753465021335 0ustar www-datawww-datarequire 'test_helper' class AttributeTest < Test::Unit::TestCase include Term::ANSIColor def test_cast color = Attribute.get(:color123) on_color = Attribute.get(:on_color123) assert_equal color, Attribute[color] assert_equal color, Attribute[:color123] assert_equal color, Attribute[123] assert_equal color, Attribute['123'] assert_equal color, Attribute['#87ffff'] assert_equal color, Attribute[ [ 0x87, 0xff, 0xff ] ] assert_equal on_color, Attribute['on_123'] assert_equal on_color, Attribute['on_#87ffff'] end def test_gray a1 = Attribute[ [ 0, 0, 0 ] ] assert_equal false, a1.gray? a2 = Attribute[ [ 255, 255, 255 ] ] assert_equal false, a2.gray? a3 = Attribute[ [ 00, 0x7f, 0xff ] ] assert_equal false, a3.gray? a4 = Attribute[ [ 0x7f, 0x7f, 0x7f ] ] assert_equal true, a4.gray? end def test_distance_to color = Attribute.nearest_rgb_color('#0f0') assert_in_delta 250.954, Attribute.get(:color0).distance_to(color), 1e-3 color = Attribute.nearest_rgb_color('#0f0') assert_in_delta 255, Attribute.get(:color0).distance_to(color, metric: RGBColorMetrics::Euclidean), 1e-3 assert_equal 1 / 0.0, Attribute.get(:color0).distance_to(nil) end def test_nearest_rgb_color assert_equal Attribute.get(:color0).rgb, Attribute.nearest_rgb_color('#000').rgb assert_equal Attribute.get(:color15).rgb, Attribute.nearest_rgb_color('#ffffff').rgb assert_equal :color248, Attribute.nearest_rgb_color('#aaa').name assert_equal :color109, Attribute.nearest_rgb_color('#aaa', gray: false).name end def test_nearest_rgb_on_color assert_equal Attribute.get(:on_color0).rgb, Attribute.nearest_rgb_on_color('#000').rgb assert_equal Attribute.get(:on_color15).rgb, Attribute.nearest_rgb_on_color('#ffffff').rgb assert_equal :on_color248, Attribute.nearest_rgb_on_color('#aaa').name assert_equal :on_color109, Attribute.nearest_rgb_on_color('#aaa', gray: false).name end def test_apply assert_equal "\e[5m", Attribute[:blink].apply assert_equal "\e[5mfoo\e[0m", Attribute[:blink].apply('foo') assert_equal "\e[5mfoo\e[0m", Attribute[:blink].apply { 'foo' } end def test_gradient g0 = Attribute[:blink].gradient_to Attribute['#30ffaa'] assert_equal [], g0 g1 = Attribute['#30ffaa'].gradient_to(Attribute['#ff507f'], steps: 9) assert_equal [ :color49, :color49, :color43, :color79, :color108, :color247, :color138, :color168, :color204 ], g1.map(&:name) g2 = Attribute['#30ffaa'].gradient_to( Attribute['#ff507f'], steps: 9, metric: RGBColorMetrics::Euclidean ) assert_equal [ :color49, :color43, :color79, :color73, :color108, :color247, :color138, :color168, :color204 ], g2.map(&:name) end def test_true_color pinkish = Attribute['#f050a0', true_coloring: true] assert_equal [ 240, 80, 160 ], pinkish.to_rgb_triple.to_a on_pinkish = Attribute['on_#f050a0', true_coloring: true] assert_equal [ 240, 80, 160 ], on_pinkish.to_rgb_triple.to_a red = Attribute['9', true_coloring: true] assert_equal [ 255, 0, 0 ], red.to_rgb_triple.to_a red = Attribute['red', true_coloring: true] assert_equal :red, red.name pinkish_pinkish = Attribute[pinkish, true_coloring: true] assert_equal pinkish, pinkish_pinkish pinkish_pinkish = Attribute[pinkish.to_rgb_triple, true_coloring: true] assert_equal pinkish.to_rgb_triple, pinkish_pinkish.to_rgb_triple pinkish_pinkish = Attribute[pinkish.to_rgb_triple.to_a, true_coloring: true] assert_equal pinkish.to_rgb_triple, pinkish_pinkish.to_rgb_triple end def test_true_color_gradient g0 = Attribute[:blink].gradient_to Attribute['#30ffaa'] assert_equal [], g0 g1 = Attribute['#30ffaa'].gradient_to( Attribute['#ff507f'], steps: 9, true_coloring: true ) assert_equal %w[ #00ffaf #1febaa #3ed7a5 #5dc3a0 #7caf9b #9b9b96 #ba8791 #d9738c #ff5f87 ], g1.map { |c| c.rgb.html } g2 = Attribute['#30ffaa'].gradient_to( Attribute['#ff507f'], steps: 9, true_coloring: true, metric: RGBColorMetrics::Euclidean ) assert_equal %w[ #00ffaf #1febaa #3ed7a5 #5dc3a0 #7caf9b #9b9b96 #ba8791 #d9738c #ff5f87 ], g2.map { |c| c.rgb.html } end end term-ansicolor-1.11.3/tests/rgb_triple_test.rb0000644000004100000410000000615315062753465021464 0ustar www-datawww-datarequire 'test_helper' class RgbTripleTest < Test::Unit::TestCase include Term::ANSIColor def test_rgb_cast rgb = RGBTriple.new(128, 0, 255) assert_equal '#8000ff', RGBTriple[ rgb ].html assert_equal '#8000ff', RGBTriple[ [ 128, 0, 255 ] ].html assert_equal '#8000ff', RGBTriple[ :red => 128, :green => 0, :blue => 255 ].html assert_equal '#11ddff', RGBTriple[ '#1df' ].html assert_equal '#8000ff', RGBTriple[ 'rgb(128,0,255)' ].html assert_equal '#85e085', RGBTriple[ 'hsl(120.0,59.4%,70.0%)' ].html assert_raises ArgumentError do RGBTriple[ nil ] end end def test_rgb_to_a rgb = RGBTriple.new(128, 0, 255) assert_equal [ 128, 0, 255 ], rgb.to_a end def test_percentages rgb = RGBTriple.new(128, 0, 255) assert_in_delta 50.19, rgb.red_p, 1e-2 assert_in_delta 0.0, rgb.green_p, 1e-2 assert_in_delta 100.0, rgb.blue_p, 1e-2 end def test_rgb_distance rgb1 = RGBTriple.new(128, 0, 255) rgb2 = RGBTriple.new(128, 200, 64) assert_in_delta 0.0, rgb1.distance_to(rgb1), 1e-3 assert_in_delta 255, RGBTriple.new(0, 0, 0).distance_to(RGBTriple.new(255, 255, 255)), 1e-3 assert_in_delta 209.935, rgb1.distance_to(rgb2), 1e-3 end def test_rgb_gray rgb1 = RGBTriple.new(0, 0, 0) assert_equal false, rgb1.gray? rgb2 = RGBTriple.new(255, 255, 255) assert_equal false, rgb2.gray? rgb3 = RGBTriple.new(12, 23, 34) assert_equal false, rgb3.gray? rgb4 = RGBTriple.new(127, 127, 127) assert_equal true, rgb4.gray? end def test_gradient rgb1 = RGBTriple.new(0, 0, 0) rgb2 = RGBTriple.new(255, 255, 255) g0 = rgb1.gradient_to(rgb2, :steps => 2) assert_equal 2, g0.size assert_equal rgb1, g0[0] assert_equal rgb2, g0[1] g1 = rgb1.gradient_to(rgb2, :steps => 3) assert_equal 3, g1.size assert_equal rgb1, g1[0] assert_equal 127, g1[1].red assert_equal 127, g1[1].green assert_equal 127, g1[1].blue assert_equal rgb2, g1[2] g2 = rgb1.gradient_to(rgb2, :steps => 6) assert_equal 6, g2.size assert_equal rgb1, g2[0] assert_equal 51, g2[1].red assert_equal 51, g2[1].green assert_equal 51, g2[1].blue assert_equal 102, g2[2].red assert_equal 102, g2[2].green assert_equal 102, g2[2].blue assert_equal 153, g2[3].red assert_equal 153, g2[3].green assert_equal 153, g2[3].blue assert_equal 204, g2[4].red assert_equal 204, g2[4].green assert_equal 204, g2[4].blue assert_equal rgb2, g2[5] end def test_invert assert_equal RGBTriple.new(127, 255, 0), RGBTriple.new(128, 0, 255).invert end def test_css rgb = RGBTriple.new(128, 0, 255) assert_equal 'rgb(128,0,255)', rgb.css assert_equal '#8000ff', RGBTriple.from_css('rgb(128,0,255)').html assert_match(/rgb\(50\.19.*?%,0\.0%,100.0%\)/, rgb.css(percentage: true)) assert_equal '#8000ff', RGBTriple.from_css('rgb(50.19607843137255%,0.0%,100.0%)').html end def test_color assert_equal "\e[38;5;93mfoo\e[0m", RGBTriple.new(128, 0, 255).color('foo') end def test_method_missing assert_raises(NoMethodError) { RGBTriple.new(0, 0, 0).foo } end end term-ansicolor-1.11.3/tests/hyperlink_test.rb0000644000004100000410000000221415062753465021332 0ustar www-datawww-datarequire 'test_helper' class HyperlinkTest < Test::Unit::TestCase include Term::ANSIColor def setup @link = 'https://foo.example.com' end def test_hyperlink_switch_on assert_equal( "\e]8;;#@link\e\\", hyperlink(@link) ) end def test_hyperlink_switch_off assert_equal( "\e]8;;\e\\", hyperlink(nil) ) end def test_hyperlink_as_link assert_equal( hyperlink(@link, as_link: true), "\e]8;;#@link\e\\#@link\e]8;;\e\\", ) end def test_hyperlink_two_args assert_equal( "\e]8;;#@link\e\\foo\e]8;;\e\\", hyperlink(@link, 'foo') ) end def test_hyperlink_two_args_with_id assert_equal( "\e]8;id=666;#@link\e\\foo\e]8;;\e\\", hyperlink(@link, 'foo', id: 666) ) end def test_hyperlink_block_arg assert_raises(ArgumentError) { hyperlink(@link, 'bar') { 'baz' } } assert_equal( "\e]8;;#@link\e\\foo\e]8;;\e\\", hyperlink(@link) { 'foo' } ) end def test_with_stringy_self string = 'foo'.dup string.extend Term::ANSIColor assert_equal "\e]8;;#@link\e\\foo\e]8;;\e\\", string.hyperlink(@link) end end term-ansicolor-1.11.3/tests/ansicolor_test.rb0000644000004100000410000002115415062753465021322 0ustar www-datawww-datarequire 'test_helper' OldString = String.dup class String include Term::ANSIColor end class Color extend Term::ANSIColor end class StringLike def initialize(string) @string = string end def to_str @string end end class ANSIColorTest < Test::Unit::TestCase include Term::ANSIColor def setup @string = "red" @string_red = "\e[31mred\e[0m" @string_red_on_green = "\e[42m\e[31mred\e[0m\e[0m" @string_like = StringLike.new(@string) @string_like_red = StringLike.new(@string_red) end attr_reader :string, :string_red, :string_red_on_green, :string_like, :string_like_red def test_red assert_equal string_red, string.red assert_equal string_red, Color.red(string) assert_equal string_red, Color.red { string } assert_equal string_red, Term::ANSIColor.red { string } assert_equal string_red, red { string } end def test_red_on_green assert_equal string_red_on_green, string.red.on_green assert_equal string_red_on_green, Color.on_green(Color.red(string)) assert_equal string_red_on_green, Color.on_green { Color.red { string } } assert_equal string_red_on_green, Term::ANSIColor.on_green { Term::ANSIColor.red { string } } assert_equal string_red_on_green, on_green { red { string } } end def test_color assert_equal "\e[38;5;128mfoo\e[0m", Color.color(:color128, "foo") assert_equal "\e[38;5;128mfoo\e[0m", "foo".color(:color128) assert_equal "\e[38;5;128mfoo\e[0m", color(:color128, "foo") assert_equal "\e[38;5;128mfoo\e[0m", Color.color(:color128) { "foo" } assert_equal "\e[38;5;128mfoo\e[0m", "foo".color(:color128) { "foo" } assert_equal "\e[38;5;128mfoo\e[0m", color(:color128) { "foo" } assert_equal "\e[38;5;128mfoo\e[0m", color(:color128) + "foo" + color(:reset) assert_equal "\e[38;5;128mfoo\e[0m", Color.color(128, "foo") assert_equal "\e[38;5;128mfoo\e[0m", "foo".color(128) assert_equal "\e[38;5;128mfoo\e[0m", color(128, "foo") assert_equal "\e[38;5;128mfoo\e[0m", Color.color(128) { "foo" } assert_equal "\e[38;5;128mfoo\e[0m", "foo".color(128) { "foo" } assert_equal "\e[38;5;128mfoo\e[0m", color(128) { "foo" } assert_equal "\e[38;5;128mfoo\e[0m", color(128) + "foo" + color(:reset) end def test_on_color assert_equal "\e[48;5;128mfoo\e[0m", Color.on_color(:color128, "foo") assert_equal "\e[48;5;128mfoo\e[0m", "foo".on_color(:color128) assert_equal "\e[48;5;128mfoo\e[0m", on_color(:color128, "foo") assert_equal "\e[48;5;128mfoo\e[0m", Color.on_color(:color128) { "foo" } assert_equal "\e[48;5;128mfoo\e[0m", "foo".on_color(:color128) { "foo" } assert_equal "\e[48;5;128mfoo\e[0m", on_color(:color128) { "foo" } assert_equal "\e[48;5;128mfoo\e[0m", on_color(:color128) + "foo" + color(:reset) assert_equal "\e[48;5;128mfoo\e[0m", Color.on_color(128, "foo") assert_equal "\e[48;5;128mfoo\e[0m", "foo".on_color(128) assert_equal "\e[48;5;128mfoo\e[0m", on_color(128, "foo") assert_equal "\e[48;5;128mfoo\e[0m", Color.on_color(128) { "foo" } assert_equal "\e[48;5;128mfoo\e[0m", "foo".on_color(128) { "foo" } assert_equal "\e[48;5;128mfoo\e[0m", on_color(128) { "foo" } assert_equal "\e[48;5;128mfoo\e[0m", on_color(128) + "foo" + color(:reset) end def test_uncolor assert_equal string, string_red.uncolor assert_equal string, Color.uncolor(string_red) assert_equal string, Color.uncolor(string_like_red) assert_equal string, Color.uncolor { string_red } assert_equal string, Color.uncolor { string_like_red } assert_equal string, Term::ANSIColor.uncolor { string_red } assert_equal string, Term::ANSIColor.uncolor { string_like_red } assert_equal string, uncolor { string } assert_equal string, uncolor { string_like_red } assert_equal "", uncolor(Object.new) for index in 0..255 assert_equal "foo", Color.uncolor(Color.color("color#{index}", "foo")) assert_equal "foo", Color.uncolor(Color.on_color("color#{index}", "foo")) end end def test_attributes foo = 'foo' attributes = %i[ clear reset bold dark faint italic underline underscore blink rapid_blink reverse negative concealed conceal strikethrough black red green yellow blue magenta cyan white on_black on_red on_green on_yellow on_blue on_magenta on_cyan on_white intense_black bright_black intense_red bright_red intense_green bright_green intense_yellow bright_yellow intense_blue bright_blue intense_magenta bright_magenta intense_cyan bright_cyan intense_white bright_white on_intense_black on_bright_black on_intense_red on_bright_red on_intense_green on_bright_green on_intense_yellow on_bright_yellow on_intense_blue on_bright_blue on_intense_magenta on_bright_magenta on_intense_cyan on_bright_cyan on_intense_white on_bright_white ] for a in attributes # skip :clear and :reverse b/c Ruby implements them on string if a != :clear && a != :reverse refute_equal foo, foo_colored = foo.__send__(a) assert_equal foo, foo_colored.uncolor end refute_equal foo, foo_colored = Color.__send__(a, foo) assert_equal foo, Color.uncolor(foo_colored) refute_equal foo, foo_colored = Color.__send__(a) { foo } assert_equal foo, Color.uncolor { foo_colored } refute_equal foo, foo_colored = Term::ANSIColor.__send__(a) { foo } assert_equal foo, Term::ANSIColor.uncolor { foo_colored } refute_equal foo, foo_colored = __send__(a) { foo } assert_equal foo, uncolor { foo_colored } end assert_equal Term::ANSIColor.attributes, 'foo'.attributes end def test_underline_invalid_type assert_raises(ArgumentError) { Term::ANSIColor.underline(type: :nix) { 'foo' } } end def test_underline_invalid_color assert_raises(ArgumentError) { Term::ANSIColor.underline(color: :nix) { 'foo' } } end def test_underline foo = 'foo' assert_equal "\e[4mfoo\e[0m", Term::ANSIColor.underline { foo } assert_equal "\e[4m\e[58;2;255;135;95mfoo\e[0m", Term::ANSIColor.underline(color: '#ff8040') { foo } end def test_underline_double foo = 'foo' assert_equal "\e[4:2mfoo\e[0m", Term::ANSIColor.underline(type: :double) { foo } assert_equal "\e[4:2m\e[58;2;255;135;95mfoo\e[0m", Term::ANSIColor.underline(type: :double, color: '#ff8040') { foo } end def test_underline_curly foo = 'foo' assert_equal "\e[4:3mfoo\e[0m", Term::ANSIColor.underline(type: :curly) { foo } assert_equal "\e[4:3m\e[58;2;255;135;95mfoo\e[0m", Term::ANSIColor.underline(type: :curly, color: '#ff8040') { foo } end def test_underline_dotted foo = 'foo' assert_equal "\e[4:4mfoo\e[0m", Term::ANSIColor.underline(type: :dotted) { foo } assert_equal "\e[4:4m\e[58;2;255;135;95mfoo\e[0m", Term::ANSIColor.underline(type: :dotted, color: '#ff8040') { foo } end def test_underline_dashed foo = 'foo' assert_equal "\e[4:5mfoo\e[0m", Term::ANSIColor.underline(type: :dashed) { foo } assert_equal "\e[4:5m\e[58;2;255;135;95mfoo\e[0m", Term::ANSIColor.underline(type: :dashed, color: '#ff8040') { foo } end def test_move_to string_23_23 = "\e[23;23Hred" assert_equal string_23_23, string.move_to(23, 23) assert_equal string_23_23, Color.move_to(23, 23, string) assert_equal string_23_23, Color.move_to(23, 23) { string } assert_equal string_23_23, Term::ANSIColor.move_to(23, 23) { string } assert_equal string_23_23, move_to(23, 23) { string } end def test_return_to_position string_return = "\e[sred\e[u" assert_equal string_return, string.return_to_position assert_equal string_return, Color.return_to_position(string) assert_equal string_return, Color.return_to_position { string } assert_equal string_return, Term::ANSIColor.return_to_position { string } assert_equal string_return, return_to_position { string } end def test_coloring_string_like assert_equal "\e[31mred\e[0m", red(string_like) end def test_frozen string = 'foo'.dup red = string.red string.extend(Term::ANSIColor).freeze assert string.frozen? assert_equal red, string.red end def test_extending string = OldString.new('new') assert_equal false, Term::ANSIColor === string string = Color.red(string) assert_kind_of Term::ANSIColor, 'new' end def test_coloring assert Term::ANSIColor.coloring? Term::ANSIColor.coloring = false assert_false Term::ANSIColor.coloring? ensure Term::ANSIColor.coloring = true end def test_true_coloring assert_false Term::ANSIColor.true_coloring? Term::ANSIColor.true_coloring = true assert Term::ANSIColor.true_coloring? ensure Term::ANSIColor.true_coloring = false end end term-ansicolor-1.11.3/tests/ppm_reader_test.rb0000644000004100000410000000303115062753465021441 0ustar www-datawww-datarequire 'test_helper' require 'digest/md5' class PPMReaderTest < Test::Unit::TestCase include Term::ANSIColor def test_loading_ppm6 File.open(example_path('lambda-red.ppm')) do |ppm6| ppm_reader = PPMReader.new(ppm6) assert_equal '2035155a4242e498f4852ae8425dac6b', Digest::MD5.hexdigest(ppm_reader.to_s) end end def test_loading_ppm3 File.open(example_path('lambda-red-plain.ppm')) do |ppm6| ppm_reader = PPMReader.new(ppm6) assert_equal '2035155a4242e498f4852ae8425dac6b', Digest::MD5.hexdigest(ppm_reader.to_s) end end def test_rendering_ppm_without_gray File.open(example_path('lambda-red.ppm')) do |ppm6| ppm_reader = PPMReader.new(ppm6, :gray => false) assert_equal '0653f40e42a87fc480e09db1c58f71ba', Digest::MD5.hexdigest(ppm_reader.to_s) end end def test_rendering_ppm_with_true_colors File.open(example_path('lambda-red.ppm')) do |ppm6| ppm_reader = PPMReader.new(ppm6, :true_coloring => true) assert_equal '5faa2b046cc3e030f86588e472683834', Digest::MD5.hexdigest(ppm_reader.to_s) end end def test_to_a File.open(example_path('lambda-red.ppm')) do |ppm6| ppm_reader = PPMReader.new(ppm6, :gray => false) ary = ppm_reader.to_a assert_equal 22, ary.size assert_equal 44, ary.first.size assert_equal [ 255, 255, 255 ], ary.first.last end end private def example_path(path = []) File.expand_path(File.join(File.dirname(__FILE__), '..', 'examples', *path)) end end term-ansicolor-1.11.3/tests/rgb_color_metrics_test.rb0000644000004100000410000001400315062753465023022 0ustar www-datawww-datarequire 'test_helper' class RGBColorMetrics < Test::Unit::TestCase include Term::ANSIColor def setup @black = RGBTriple.new(0, 0, 0) @white = RGBTriple.new(255, 255, 255) @red = RGBTriple.new(255, 0, 0) @bright_orange = RGBTriple.new(0, 200, 128) end def test_metric_getters assert_raises(ArgumentError) { RGBColorMetrics.metric('Foo') } assert_equal RGBColorMetrics::Euclidean, RGBColorMetrics.metric('Euclidean') assert_equal RGBColorMetrics::Euclidean, RGBColorMetrics.metric(:Euclidean) assert_operator RGBColorMetrics.metrics.size, :>, 1 assert_equal true, RGBColorMetrics.metrics.include?(:Euclidean) assert RGBColorMetrics.metric?(:Euclidean) assert_equal RGBColorMetrics::Euclidean, RGBColorMetrics.metric?(:Euclidean) end def test_euclidean assert_in_delta 255, RGBColorMetrics::Euclidean.distance(@black, @red), 1e-3 assert_in_delta 255, RGBColorMetrics::Euclidean.distance(@red, @black), 1e-3 assert_in_delta 360.624, RGBColorMetrics::Euclidean.distance(@white, @red), 1e-3 assert_in_delta 360.624, RGBColorMetrics::Euclidean.distance(@red, @white), 1e-3 assert_in_delta 441.672, RGBColorMetrics::Euclidean.distance(@white, @black), 1e-3 assert_in_delta 441.672, RGBColorMetrics::Euclidean.distance(@black, @white), 1e-3 assert_in_delta 237.453, RGBColorMetrics::Euclidean.distance(@black, @bright_orange), 1e-3 assert_in_delta 237.453, RGBColorMetrics::Euclidean.distance(@bright_orange, @black), 1e-3 assert_in_delta 290.136, RGBColorMetrics::Euclidean.distance(@white, @bright_orange), 1e-3 assert_in_delta 290.136, RGBColorMetrics::Euclidean.distance(@bright_orange, @white), 1e-3 end def test_ntsc assert_in_delta 139.436, RGBColorMetrics::NTSC.distance(@black, @red), 1e-3 assert_in_delta 139.436, RGBColorMetrics::NTSC.distance(@red, @black), 1e-3 assert_in_delta 213.500, RGBColorMetrics::NTSC.distance(@white, @red), 1e-3 assert_in_delta 213.500, RGBColorMetrics::NTSC.distance(@red, @white), 1e-3 assert_in_delta 255, RGBColorMetrics::NTSC.distance(@white, @black), 1e-3 assert_in_delta 255, RGBColorMetrics::NTSC.distance(@black, @white), 1e-3 assert_in_delta 159.209, RGBColorMetrics::NTSC.distance(@black, @bright_orange), 1e-3 assert_in_delta 159.209, RGBColorMetrics::NTSC.distance(@bright_orange, @black), 1e-3 assert_in_delta 151.844, RGBColorMetrics::NTSC.distance(@white, @bright_orange), 1e-3 assert_in_delta 151.844, RGBColorMetrics::NTSC.distance(@bright_orange, @white), 1e-3 end def test_compu_phase assert_in_delta 360.624, RGBColorMetrics::CompuPhase.distance(@black, @red), 1e-3 assert_in_delta 360.624, RGBColorMetrics::CompuPhase.distance(@red, @black), 1e-3 assert_in_delta 624.619, RGBColorMetrics::CompuPhase.distance(@white, @red), 1e-3 assert_in_delta 624.619, RGBColorMetrics::CompuPhase.distance(@red, @white), 1e-3 assert_in_delta 721.248, RGBColorMetrics::CompuPhase.distance(@white, @black), 1e-3 assert_in_delta 721.248, RGBColorMetrics::CompuPhase.distance(@black, @white), 1e-3 assert_in_delta 439.053, RGBColorMetrics::CompuPhase.distance(@black, @bright_orange), 1e-3 assert_in_delta 439.053, RGBColorMetrics::CompuPhase.distance(@bright_orange, @black), 1e-3 assert_in_delta 417.621, RGBColorMetrics::CompuPhase.distance(@white, @bright_orange), 1e-3 assert_in_delta 417.621, RGBColorMetrics::CompuPhase.distance(@bright_orange, @white), 1e-3 end def test_yuv assert_in_delta 178.308, RGBColorMetrics::YUV.distance(@black, @red), 1e-3 assert_in_delta 178.308, RGBColorMetrics::YUV.distance(@red, @black), 1e-3 assert_in_delta 240.954, RGBColorMetrics::YUV.distance(@white, @red), 1e-3 assert_in_delta 240.954, RGBColorMetrics::YUV.distance(@red, @white), 1e-3 assert_in_delta 255, RGBColorMetrics::YUV.distance(@white, @black), 1e-3 assert_in_delta 255, RGBColorMetrics::YUV.distance(@black, @white), 1e-3 assert_in_delta 175.738, RGBColorMetrics::YUV.distance(@black, @bright_orange), 1e-3 assert_in_delta 175.738, RGBColorMetrics::YUV.distance(@bright_orange, @black), 1e-3 assert_in_delta 169.082, RGBColorMetrics::YUV.distance(@white, @bright_orange), 1e-3 assert_in_delta 169.082, RGBColorMetrics::YUV.distance(@bright_orange, @white), 1e-3 end def test_ciexyz assert_in_delta 124.843, RGBColorMetrics::CIEXYZ.distance(@black, @red), 1e-3 assert_in_delta 124.843, RGBColorMetrics::CIEXYZ.distance(@red, @black), 1e-3 assert_in_delta 316.014, RGBColorMetrics::CIEXYZ.distance(@white, @red), 1e-3 assert_in_delta 316.014, RGBColorMetrics::CIEXYZ.distance(@red, @white), 1e-3 assert_in_delta 411.874, RGBColorMetrics::CIEXYZ.distance(@white, @black), 1e-3 assert_in_delta 411.874, RGBColorMetrics::CIEXYZ.distance(@black, @white), 1e-3 assert_in_delta 137.920, RGBColorMetrics::CIEXYZ.distance(@black, @bright_orange), 1e-3 assert_in_delta 137.920, RGBColorMetrics::CIEXYZ.distance(@bright_orange, @black), 1e-3 assert_in_delta 280.023, RGBColorMetrics::CIEXYZ.distance(@white, @bright_orange), 1e-3 assert_in_delta 280.023, RGBColorMetrics::CIEXYZ.distance(@bright_orange, @white), 1e-3 end def test_cielab assert_in_delta 174.656, RGBColorMetrics::CIELab.distance(@black, @red), 1e-3 assert_in_delta 174.656, RGBColorMetrics::CIELab.distance(@red, @black), 1e-3 assert_in_delta 158.587, RGBColorMetrics::CIELab.distance(@white, @red), 1e-3 assert_in_delta 158.587, RGBColorMetrics::CIELab.distance(@red, @white), 1e-3 assert_in_delta 255, RGBColorMetrics::CIELab.distance(@white, @black), 1e-3 assert_in_delta 255, RGBColorMetrics::CIELab.distance(@black, @white), 1e-3 assert_in_delta 191.927, RGBColorMetrics::CIELab.distance(@black, @bright_orange), 1e-3 assert_in_delta 191.927, RGBColorMetrics::CIELab.distance(@bright_orange, @black), 1e-3 assert_in_delta 95.084, RGBColorMetrics::CIELab.distance(@white, @bright_orange), 1e-3 assert_in_delta 95.084, RGBColorMetrics::CIELab.distance(@bright_orange, @white), 1e-3 end end term-ansicolor-1.11.3/Rakefile0000644000004100000410000000203615062753465016246 0ustar www-datawww-data# vim: set filetype=ruby et sw=2 ts=2: require 'gem_hadar' GemHadar do name 'term-ansicolor' path_name 'term/ansicolor' path_module 'Term::ANSIColor' author 'Florian Frank' email 'flori@ping.de' homepage "https://github.com/flori/#{name}" summary 'Ruby library that colors strings using ANSI escape sequences' description 'This library uses ANSI escape sequences to control the attributes of terminal output' licenses << 'Apache-2.0' test_dir 'tests' ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', '.rvmrc', 'coverage', 'tags', '.bundle', '.byebug_history', 'errors.lst', 'cscope.out' package_ignore '.all_images.yml', '.tool-versions', '.gitignore', 'VERSION', '.utilsrc', '.rspec', 'TODO' readme 'README.md' executables.merge Dir['bin/*'].map { |x| File.basename(x) } dependency 'tins', '~>1' development_dependency 'simplecov' development_dependency 'test-unit' development_dependency 'debug' development_dependency 'all_images', '~> 0.8' end term-ansicolor-1.11.3/Gemfile0000644000004100000410000000011715062753465016072 0ustar www-datawww-data# vim: set filetype=ruby et sw=2 ts=2: source 'https://rubygems.org' gemspec term-ansicolor-1.11.3/LICENSE0000644000004100000410000002612415062753465015612 0ustar www-datawww-data Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [2017] [Florian Frank] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. term-ansicolor-1.11.3/README.md0000644000004100000410000000240715062753465016062 0ustar www-datawww-data# Term::ANSIColor - ANSI escape sequences in Ruby ## Description This library can be used to color/decolor strings using ANSI escape sequences. ## Installation Use rubygems to install the gem: ``` # gem install term-ansicolor ``` ## Download The homepage of this library is located at * https://github.com/flori/term-ansicolor ## Examples The following executables are provided with Term::ANSIColor: * `term_cdiff`: colors a diff patch * `term_colortab`: Displays a table of the 256 terminal colors with their indices and nearest html equivalents. * `term_display`: displays a ppm3 or ppm6 image file in the terminal. If the netpbm programs are installed it can handle a lot of other image file formats. * `term_decolor`: decolors any text file that was colored with ANSI escape sequences * `term_mandel`: displays the mandelbrot set in the terminal * `term_plasma`: draws a plasma effect on the console, possibly animated and refreshed every `-n seconds`. * `term_snow`: displays falling snow in the terminal using ANSI movement sequences. Additionally the file examples/example.rb in the source/gem-distribution shows how this library can be used. ## Author Florian Frank mailto:flori@ping.de ## License This software is licensed under the Apache 2.0 license. term-ansicolor-1.11.3/examples/0000755000004100000410000000000015062753465016416 5ustar www-datawww-dataterm-ansicolor-1.11.3/examples/lambda-red-plain.ppm0000644000004100000410000002624415062753465022235 0ustar www-datawww-dataP3 44 22 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 249 242 242 236 209 209 230 188 188 229 182 182 229 182 182 230 188 187 235 207 207 247 238 238 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 246 234 234 215 137 136 203 34 30 206 30 24 206 29 24 206 28 24 207 29 24 206 28 24 206 28 24 203 30 25 213 126 125 244 229 229 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 247 237 238 202 67 64 206 28 24 205 29 24 202 37 32 207 68 65 207 96 95 208 91 89 204 52 49 203 28 23 206 28 24 206 28 24 202 51 47 234 207 207 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 227 184 184 205 29 24 212 124 123 241 221 221 253 250 250 255 255 255 255 255 255 255 255 255 255 254 254 249 239 239 230 194 194 206 82 80 206 28 24 202 36 32 234 207 207 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 243 230 230 234 204 203 250 245 245 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 250 244 244 209 118 117 206 29 24 202 47 43 242 223 223 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 250 245 245 206 98 97 206 28 24 202 74 72 247 237 238 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 246 234 234 201 41 37 206 28 24 206 105 104 252 247 247 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 254 251 252 215 146 146 204 28 24 206 28 24 206 29 24 213 137 136 255 253 253 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 252 248 249 212 133 132 205 28 24 206 28 24 206 29 24 206 29 24 204 29 24 221 169 168 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 250 245 245 209 118 117 205 28 24 206 29 24 206 28 24 206 28 24 206 28 24 206 28 24 202 29 25 231 198 198 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 249 240 240 207 104 103 206 29 24 206 28 24 206 29 24 206 28 24 206 28 24 206 28 24 205 32 27 206 29 24 202 44 40 240 219 219 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 246 236 236 206 90 89 206 28 24 206 28 24 206 28 24 206 28 24 206 28 24 206 28 24 206 105 103 243 228 229 204 92 91 206 28 24 202 71 68 246 235 235 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 244 229 229 203 77 75 206 28 24 206 28 24 206 28 24 206 29 24 206 28 24 205 30 24 210 120 118 250 245 245 255 255 255 245 233 233 202 64 61 206 28 24 206 101 100 251 246 247 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 241 222 221 203 64 62 206 28 24 206 28 24 206 28 24 206 28 24 206 29 24 205 29 24 213 135 134 252 249 249 255 255 255 255 255 255 255 255 255 239 216 215 202 38 34 206 30 24 212 132 130 255 253 253 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 237 212 212 202 53 49 206 28 24 206 28 24 206 28 24 206 28 24 206 28 24 204 29 24 217 152 151 254 252 252 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 229 192 192 202 29 25 204 29 24 220 164 164 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 233 203 203 203 41 36 206 29 24 205 28 24 206 28 24 206 28 24 206 28 24 204 29 25 221 167 167 255 254 254 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 219 162 162 205 29 24 202 30 25 230 194 194 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 229 191 191 202 32 28 206 29 24 206 28 24 206 29 24 206 28 24 206 29 24 203 31 26 227 182 182 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 254 252 253 212 131 130 206 30 24 203 41 35 236 211 211 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 252 250 250 249 243 243 251 247 247 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 224 177 177 203 29 25 206 28 24 206 28 24 206 28 24 206 28 24 206 29 24 203 38 34 232 197 197 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 251 246 246 205 100 98 206 29 24 203 42 38 229 192 191 255 254 254 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 254 252 252 214 141 140 203 26 22 206 130 130 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 254 254 220 163 163 204 29 24 206 28 24 206 28 24 206 28 24 206 28 24 206 29 24 203 49 46 236 209 209 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 247 235 235 202 69 67 206 29 24 205 29 24 209 96 94 224 166 165 232 190 190 233 203 203 233 195 194 225 170 170 209 95 93 205 29 24 206 28 24 213 147 147 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 254 252 252 216 149 148 205 28 24 206 29 24 206 28 24 206 28 24 206 28 24 206 28 24 202 62 59 239 219 219 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 243 226 226 203 72 69 206 29 24 206 28 24 206 28 24 206 28 24 206 28 24 206 28 24 206 28 24 206 28 24 206 29 24 204 79 76 246 233 234 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 252 250 250 209 137 136 202 33 29 203 33 29 203 33 28 203 33 28 203 33 28 203 34 28 203 78 76 243 228 228 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 249 241 241 223 164 163 205 75 73 203 29 24 205 28 24 206 28 24 206 28 24 203 30 25 208 90 88 224 174 173 250 244 244 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 248 241 241 243 228 228 242 227 226 243 228 228 249 244 244 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 term-ansicolor-1.11.3/examples/example.rb0000755000004100000410000001113615062753465020403 0ustar www-datawww-data#!/usr/bin/env ruby # require 'term/ansicolor' # Use this trick to work around namespace cluttering that # happens if you just include Term::ANSIColor: Color = Object.new.extend Term::ANSIColor print Color.red, Color.bold, "No Namespace cluttering:", Color.clear, "\n" print Color.green + "green" + Color.clear, "\n" print Color.on_red(Color.green("green")), "\n" print Color.yellow { Color.on_black { "yellow on_black" } }, "\n\n" # Or shortcut Term::ANSIColor by assignment: c = Term::ANSIColor print c.red, c.bold, "No Namespace cluttering (alternative):", c.clear, "\n" print c.green + "green" + c.clear, "\n" print c.on_red(c.green("green")), "\n" print c.yellow { c.on_black { "yellow on_black" } }, "\n\n" # Anyway, I don't define any of Term::ANSIColor's methods in this example # and I want to keep it short: include Term::ANSIColor print red, bold, "Usage as constants:", reset, "\n" print clear, "clear", reset, reset, "reset", reset, bold, "bold", reset, dark, "dark", reset, underscore, "underscore", reset, blink, "blink", reset, negative, "negative", reset, concealed, "concealed", reset, "|\n", black, "black", reset, red, "red", reset, green, "green", reset, yellow, "yellow", reset, blue, "blue", reset, magenta, "magenta", reset, cyan, "cyan", reset, white, "white", reset, "|\n", on_black, "on_black", reset, on_red, "on_red", reset, on_green, "on_green", reset, on_yellow, "on_yellow", reset, on_blue, "on_blue", reset, on_magenta, "on_magenta", reset, on_cyan, "on_cyan", reset, on_white, "on_white", reset, "|\n\n" print red, bold, "Usage as unary argument methods:", reset, "\n" print clear("clear"), reset("reset"), bold("bold"), dark("dark"), underscore("underscore"), blink("blink"), negative("negative"), concealed("concealed"), "|\n", black("black"), red("red"), green("green"), yellow("yellow"), blue("blue"), magenta("magenta"), cyan("cyan"), white("white"), "|\n", on_black("on_black"), on_red("on_red"), on_green("on_green"),# on_yellow("on_yellow"), on_blue("on_blue"), on_magenta("on_magenta"), on_cyan("on_cyan"), on_white("on_white"), "|\n\n" print red { bold { "Usage as block forms:" } }, "\n" print clear { "clear" }, reset { "reset" }, bold { "bold" }, dark { "dark" }, underscore { "underscore" }, blink { "blink" }, negative { "negative" }, concealed { "concealed" }, "|\n", black { "black" }, red { "red" }, green { "green" }, yellow { "yellow" }, blue { "blue" }, magenta { "magenta" }, cyan { "cyan" }, white { "white" }, "|\n", on_black { "on_black" }, on_red { "on_red" }, on_green { "on_green" }, on_yellow { "on_yellow" }, on_blue { "on_blue" }, on_magenta { "on_magenta" }, on_cyan { "on_cyan" }, on_white { "on_white" }, "|\n\n" # Usage as Mixin into String or its Subclasses class String include Term::ANSIColor end print "Usage as String Mixins:".red.bold, "\n" print "clear".clear, "reset".reset, "bold".bold, "dark".dark, "underscore".underscore, "blink".blink, "negative".negative, "concealed".concealed, "|\n", "black".black, "red".red, "green".green, "yellow".yellow, "blue".blue, "magenta".magenta, "cyan".cyan, "white".white, "|\n", "on_black".on_black, "on_red".on_red, "on_green".on_green, "on_yellow".on_yellow, "on_blue".on_blue, "on_magenta".on_magenta, "on_cyan".on_cyan, "on_white".on_white, "|\n\n" symbols = Term::ANSIColor::attributes print red { bold { "All supported attributes = " } }, symbols.map { |s| __send__(s, s.inspect) } * ",\n", "\n\n" print "Send symbols to strings:".send(:red).send(:bold), "\n" print symbols[12, 8].map { |c| c.to_s.send(c) } * '', "\n\n" print red { bold { "Use true colors if supported" } }, "\n" colors = Term::ANSIColor::Attribute['#ff0000'].gradient_to( Term::ANSIColor::Attribute['#ffff00'], true_coloring: true, step: 16 ) colors += Term::ANSIColor::Attribute[colors.last].gradient_to( Term::ANSIColor::Attribute['#00ff00'], true_coloring: true, step: 16 ) colors += Term::ANSIColor::Attribute[colors.last].gradient_to( Term::ANSIColor::Attribute['#00ffff'], true_coloring: true, step: 16 ) colors += Term::ANSIColor::Attribute[colors.last].gradient_to( Term::ANSIColor::Attribute['#0000ff'], true_coloring: true, step: 16 ) chars = %w[ ⣾ ⣽ ⣻ ⢿ ⡿ ⣟ ⣯ ⣷ ] colors.each_with_index { |c, i| print c.apply { chars[i % chars.size] } } puts puts print red { bold { "Make strings monochromatic again:" } }, "\n" print [ "red".red, "not red anymore".red.uncolored, uncolored { "not red anymore".red }, uncolored("not red anymore".red) ].map { |x| x + "\n" } * '' puts "Use the " + "Source".hyperlink("https://github.com/flori/term-ansicolor") + ", Luke!" term-ansicolor-1.11.3/examples/lambda-red.png0000644000004100000410000003124415062753465021120 0ustar www-datawww-dataPNG  IHDR s CiCCPICC profilexڝSwX>eVBl"#Ya@Ņ VHUĂ H(gAZU\8ܧ}zy&j9R<:OHɽH gyx~t?op.$P&W " R.TSd ly|B" I>ةآ(G$@`UR,@".Y2GvX@`B, 8C L0ҿ_pH˕͗K3w!lBa)f "#HL 8?flŢko">!N_puk[Vh]3 Z zy8@P< %b0>3o~@zq@qanvRB1n#Dž)4\,XP"MyRD!ɕ2 w ONl~Xv@~- g42y@+͗\LD*A aD@ $<B AT:18 \p` Aa!:b""aH4 Q"rBj]H#-r9\@ 2G1Qu@Ơst4]k=Kut}c1fa\E`X&cX5V5cX7va$^lGXLXC%#W 1'"O%zxb:XF&!!%^'_H$ɒN !%2I IkHH-S>iL&m O:ňL $RJ5e?2BQͩ:ZImvP/S4u%͛Cˤ-Кigih/t ݃EЗkw Hb(k{/LӗT02goUX**|:V~TUsU?y TU^V}FUP թU6RwRPQ__c FHTc!2eXBrV,kMb[Lvv/{LSCsfffqƱ9ٜJ! {--?-jf~7zھbrup@,:m:u 6Qu>cy Gm7046l18c̐ckihhI'&g5x>fob4ekVyVV׬I\,mWlPW :˶vm))Sn1 9a%m;t;|rtuvlp4éĩWggs5KvSmnz˕ҵܭm=}M.]=AXq㝧/^v^Y^O&0m[{`:>=e>>z"=#~~~;yN`k5/ >B Yroc3g,Z0&L~oL̶Gli})*2.QStqt,֬Yg񏩌;jrvgjlRlc웸xEt$ =sl3Ttcܢ˞w|/9%bKGD pHYs  ~tIME94`M9 IDATx]w>efg+`%65ƈ1"jX%h51g! EEA( .e[xgggfg-08>ԋ"BH4jl`R bzS ,LB,~_U^W/|'_孬s/yٛ+v9~<z ex\=K! c禵_-,\"Ul[3Q0h0A:(gaWpđ޹$DŮO_y|y.W^MQuR@Nt08('@P4Flj_8t=.K_>=cOs\.G8zDC4ÙIXͬ~a.& um)c:fKceW37p#]ǎ+qM}(#72c{YHH1hXSԻ-)Jz;;>yh48z'n)|g)@@s47'<enG 6dZͬS&c$\e4ʒ-lAe428EO{XW>1]o;#s<7(~@8(wZ>̌sTO8 (*W*ʋslNQE,cÏ?G"D n@Ĩ B_ٶ=& ׮D`lXdnC̸jP@3%o}dO` 4=``^ )Lp`AZߚwj"=]-t Sagfް~9vWybTI ᢺڵ[+#ϲJ?`yt 0E,i/TЎ-_gYn% $XJǓ"A4C =&Y] ݋yf1d%: FD9+ܲRh=Ej81XSKZDi}ѥ) |߸}Q7Ïc8 D>-z":i"nUU &"!,h;5֏|!׮xM),DugBa/ 2X&TRAv!_W5:.A# 5j97x[."Ͱ<GPZ.ԫ'T8^{/DZ!/;6\6կ[+<;'*l39!GڟpjYZ Fb[PmqFI:>Պ{X̀0k7UV}֫[QMF4H,2|}o(4д`X7/YЩڴQ79_JԎX=x^ue5>hIq_b7 [6nt{@Yzy]t&P]Zuѥ{QǔY_Bq!/JtיF]As ! vСg_mU(J9.P0,d`w5#]][jN+CP8JT"('@gVkk<iߨ 'bz-ΐ]ǞR̰ݦL;BX,C(NDlw24~}g?jF(b|OwܵOX 'aXZxY:S9 l[`Y 0ɰ.}+BMqeC賡?X ,$tsy<?~Lݶ5HY@D=!_C-^"\֞_d%-@ @~ǝ}V5G4"`-fZH> x2Ps-U]"\UY V ӕ|$@Y-xb2ؐjo06"olH`VYYTByB~~Qx+`ZR- /#t܈`+HÅc4ҀH,[~QD{,@3%474\gRg}|7s ,,0Rj sѴi6>jӈHxL\"=^5 /4?af|C78omtmf3QlK;~.ӶULS&c}uGSd' H[Ns]s򀺟6Hg,"inb1g# u/:wUάxT;l -s撏Ӥ2iw?6 }1ìM *zsjA&5[6W,p" ,[9kFMau]NtC QՕfYiOeS{o cJA~-n7̟4 ]/vڮF3l ~PTEJU3sLB&k]bu6A@ l/zn6+JI+Uhe+2[qkKۿ Hffoo0kR,{}YչL f? *Xf4K n<< üyF-Sd16s=.U5 ̓xíB_Mߨ%%rHK!ks[=&K1 `ozqXv$R829 ?c6!q?D+ 䤒凩{Ըî>AlCBo2)Rs94p!: -?PY?!,gb.Fe!mg {])Y*N`=2lXvok" p /!&e靷wy aնӀA/(j]> Ћaٴ'*rIw}8+&ubjpuk f,}ׄMMnbZ4L)d~ԓэd044,=#d3&p35}"`/ϱ*+]"񪹃xD(@\̆7 =Q%UpT}SrEepG* zaG LE@\z(/X(xdpQbun9%mj~ݲW_.TؕPhhUԃ}~@L M,8Ģu.IbjZk~Jz=F@b`uH@y=f>O<٧ͷ֙7X.۷*LD_嗲I#Gk̛7 suN8%¨J&H կh"I>kPo=AخF\AmjX(#W!({XWaQͯ{DM$OxыՀ2j"!k>lkfmUp̝ Ǟ$sɄ]n-vhGXy#%_$1"K38耼~D9_RfcF`@Z8ɪeײ;"J[ 7ʓ:yMwMh;棜T°i|&]>p*Ȱ A@K:SG =*reՈq J7s*랚z pRMYR|?̓ﺏBq#z9(+B/XD辀 2T('% ={cxͷ4#\XOsO1эI%aŌ)93].;2%Pk?Y%f,' ǂRK@ƀŽ^6'J68i aAqTuyĸ]$$% X?ன`P) Frm@ړk7 :TQ,zT ^٪ :csF `0G]q%BQtB.-9p UbإbHaj%mٚ2Z{ ~ƴ^!hth1~"Ó3&f#"6A}Uri~vh"ٶlx~&z$9ejC:9T &lBIɈ^ Bw]ӏ !K/UՔ%~mAAea/A+VO5h LoX"1LN y^߫sRZҾ ^YK3 +;^e `o4@N0خ%\D%q7\y_nJzv% ]x3=ISMߴ;$ `s)};BhQ_j'Px˒+ӏ?9ԒӀh2lذok H[vIs¨?'"zP?S&'/ܗ``Y#l V̎VlF58f ==a"aGdn@b' X+z C]W@4-˅ l5}-E5񧛷 ثvG?J@6/l3uRN8Qu $uL/,nb-d,yaviІy.޵~].ۚ!б Q,;&Q-@BpNy~"h-ZAIص+ѸdNTÜ{M:f2%~Vţ_ _\gjnބ_Ϟ&:C,޶)9cDt@@Wu1:#>\S/΍E0jp"?4$K" 32ǷmY1ũkU*~XMF=JMGP-9"T E  Ss܈T?>XBPbG*fV ob:kbAbS,`Fu~n`eu*@]" j"K(YW .Xk+„+P'W=D2t:`=NtYHpmgc 6DSAeb] _l8d;j.trfj=#CJ<Ƨ.,S5p3HSa?Oe2ޝXmz8C*acN=QG<{3=U}ͷA^ .PRI36gr&#UWt&1sX=--dy#+J4.,s|8"LcҔ ͛sřNb,_&PԣocN!-: TmɌ5$ _ݸpP9WNsΫ25 ˾{N3λ5L;Ӧ+(ڮjbQaB:]eZjC[3YZ~vN(0baD>؃TztȢ_ݻ (#;''''7'77777GAn R;ylD8Y)UṆtmR!G\rE)VF2+lx;}v ׮:1LOeZpt};t}52љcN.2ÆչU;Ε( |tذtQ44,X MH>N~X-Nfwf۶.[G#o;QZw@~" 5y@qJsD#Q4b> )G;vt<wY *py[ n:GA$>&d:@îo}'keC!Z8K"!WU~:Q[X[3TRu2g ;hͻ`@VN~vN^=g[d݅)v~{HF0t*csUг C][_UBh2.s?7_EB3l5?VD5#G1ASbxͪ X&-.^}/ ^=8ulǣ#3OZM5HPjd }XS536 ,a5N7 tUP\mx^K>vù&lYА<"߹jWo B0AU+ o*s/䴰zgLHt Kٳw'@0dhHi~#op1S]onz`kCl-wܖ]WPai7oWǞTZչ7"9.G$"hGӚ,{Zx΋t7^{NvsRIDATKt+G㎃Nڵe+Wn{/5/skQO SN$(>5EQ><DKJZ*:Y Z]c-&bB 0Ou&רZ#`am|02 ]~~Ə?qm^j=߬/vyJU7He J38@ر|sD#~]h X8 T%B.{^,(bezF_3.P, GѠ~G%~ʫҞVI kמ=WUvzh8CmjXz 85Q.jw|b92 Mq#~؍[ jq]gw &!~ɂ_|#5M bT(J@';0U!Txtl ,#/tE;I޺wz-! bTݏH[*>ֿBNVvR_wE0D6_@D/W*JB@PNThv?V+SQCϿTJf805#~E1c^X( GRF*k9SVwz;'>-6-a!ɴFT'FB~5WQi[lh&^ * )nďO>y:Vs1\; j\5F Ч?ݲ6,kgOEAVVky>DOo(gjR~^{ 5E% p:VZjYh qw]SNq{ &9nO%>0#r"wPn}yn=v_ݱ9/)Շ&"Ԅ51٘ܤ)$ݧۢ忿 㶶ԃ)#౱&"db*&֍΂ܣ1.EC`^থ达᪪_]Փؕ>;HEOLщ!!!!!"NLߤKIZX஭