Sha256: 40489d4fa9fbe75039981fe3ec7e3cbb8f1367eda30b0de3b44725991b415999

Contents?: true

Size: 785 Bytes

Versions: 7

Compression:

Stored size: 785 Bytes

Contents

require "curses"
include Curses

init_screen
begin
  attrs = {
    A_NORMAL =>     'Normal display (no highlight)',
    A_STANDOUT =>   'Best highlighting mode of the terminal',
    A_UNDERLINE =>  'Underlining',
    A_REVERSE =>    'Reverse video',
    A_BLINK =>      'Blinking',
    A_DIM =>        'Half bright',
    A_BOLD =>       'Extra bright or bold',
    A_PROTECT =>    'Protected mode',
    A_INVIS =>      'Invisible or blank mode',
    A_ALTCHARSET => 'Alternate character set',
  }

  longest_description = attrs.values.map(&:size).max
  attrs.each { |attribute, description|

    attrset(A_NORMAL)
    addstr("#{description.ljust(longest_description)}: ")

    attrset(attribute)
    addstr([*('a'..'z'), *('0'..'9')].join + "\n")
  }
  getch

ensure
  close_screen
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
curses-1.4.7 sample/attr_demo.rb
curses-1.4.6 sample/attr_demo.rb
curses-1.4.5 sample/attr_demo.rb
curses-1.4.4 sample/attr_demo.rb
curses-1.4.4.beta.1 sample/attr_demo.rb
curses-1.4.3 sample/attr_demo.rb
curses-1.4.2 sample/attr_demo.rb