My ruby-ncurses says that I have 256 colors, (the constant Ncurses.COLORS). Using some ruby scripts that use escape sequences, I am able to print 256 colors. Does anyone know how to access these 256 colors using ruby-ncurses?
(I obviously do have xterm-256color and screen-256color working on my system for ruby to say 256).
Using an escape sequence [...]
Archive for November, 2008
256 colors with ruby-ncurses
November 30, 2008ncurses: friendly colors
November 30, 2008It was a lot easier than I thought. English color names such as green and red can be converted to their constant names (thanks to Sup):
Ncurses.const_get “COLOR_#{colorstring.upcase}”
Using this simple line of code, one may maintain a hash containing color_pairs for whatever colors are in use. Whenever, a color is requested, one returns it from [...]
Trapping multiple keys for application
November 26, 2008This could help you if you require to map multiple keys like emacs (C-x C-d) or C-x q etc to methods. My first find was manveru’s “VER” which (I presume) means Vi Emacs in ruby.
I am using his keyboard.rb to trap keys – helpful in escape combinations and meta-key trapping.
However, his excellent keymapper was not [...]
Implementing a multi-line entry field in ncurses
November 25, 2008I have uploaded the code for RubyCurses onto http://github.com/rkumar/rbcurse/tree/master.
Please note that it will take a week or so for the code to be usable, I have not yet saved the form data as yet, only entered and edited.
Just some thoughts on ML fields. There are various approaches to doing this that came in mind.
1. python [...]
rubycurses – Some code samples
November 25, 2008Here’s how you might create a messagebox (image in previous post):
@mb = RubyCurses::MessageBox.new do
title “Color selector”
message “Choose a color”
type :custom
[...]
Friendlier curses with ruby
November 24, 2008I’ve been working for the last month or two, on an application builder for ncurses, using ruby. I’ve been learning both ncurses and ruby and thus have written and rewritten and refactored my work, so many times ….
Finally, the other day I thought i would just try out creating a field in pure ruby (on [...]
Recent Comments