INNER CODE UNIT · Ruby

self

busyloop/lolcat · lib/lolcat/lol.rb:101

  def self.println_ani(str, opts={}, chomped)
    return if str.empty?
    print "\e7"
    @real_os = @os
    (1..opts[:duration]).each do |i|
      print "\e8"
      @os += opts[:spread]
      println_plain(str, opts, chomped)
      str.gsub!(/\e\[[0-?]*[@JKPX]/, "")
      sleep 1.0/opts[:speed]
    end
    @os = @real_os
  end

  def self.set_mode(truecolor)
    # @paint_mode_detected = Paint.mode
    @paint_mode_detected = %w[truecolor 24bit].include?(ENV['COLORTERM']) ? 0xffffff : 256
    Paint.mode = truecolor ? 0xffffff : @paint_mode_detected

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…