Class: WindowTerminal::ColoredWrappedText

Inherits:
WrappedText show all
Defined in:
lib/accu-window.rb

Overview

A subclass of WrappedText which adds compatibility for different colors.

Instance Attribute Summary

Attributes inherited from Text

#orientation, #text, #y

Instance Method Summary collapse

Methods inherited from WrappedText

#render

Methods inherited from Text

#get_length, #render_line, #set_text, #to_s

Constructor Details

#initialize(orientation, text, y, color = :green, mode = :destroy) ⇒ ColoredWrappedText

Initializes a ColoredWrappedText object.



325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/accu-window.rb', line 325

def initialize(orientation,text,y,color=:green,mode=:destroy)
	@color = color
	if WindowTerminal.os == :linux then
		if @color == :green then
			text = "\e[#{32}m#{text}\e[0m"
		elsif @color == :red then
			text = "\e[#{31}m#{text}\e[0m"
		elsif @color == :yellow then
			text = "\e[#{33}m#{text}\e[0m"
		elsif @color == :pink then
			text = "\e[#{35}m#{text}\e[0m"
		end
	end
	super(orientation,text,y,mode)
end