Develop and Download Open Source Software

Browse Subversion Repository

Contents of /ncurses/ncurses_color.rb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 24 - (show annotations) (download)
Tue Apr 10 13:07:50 2007 UTC (16 years, 11 months ago) by bluedwarf
File size: 1791 byte(s)
Improved the redraw method of Gtk.

1 # ncurses_color.rb: Color manager for Ncurses mode.
2 #
3 # Copyright (C) 2007 Takashi Nakamoto
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License version 2 as
7 # published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 # 02110-1301 USA.
18 #
19
20 module Edmaru::Ncurses
21
22 #Color management module for NCurses.
23 module NcursesColor
24 COLOR_TABLE = {
25 "black" => Ncurses::COLOR_BLACK,
26 "red" => Ncurses::COLOR_RED,
27 "green" => Ncurses::COLOR_GREEN,
28 "yellow" => Ncurses::COLOR_YELLOW,
29 "blue" => Ncurses::COLOR_BLUE,
30 "magenta" => Ncurses::COLOR_MAGENTA,
31 "cyan" => Ncurses::COLOR_CYAN,
32 "white" => Ncurses::COLOR_WHITE
33 }
34
35 MODELINE_PAIR = 2
36
37 def NcursesColor.init_colors(config)
38 Ncurses::start_color
39
40 fg_color = config["/UI/NCurses/Color/Foreground"]
41 bg_color = config["/UI/NCurses/Color/Background"]
42 Ncurses::assume_default_colors(COLOR_TABLE[fg_color],
43 COLOR_TABLE[bg_color])
44
45 fg_color = config["/UI/NCurses/Color/ModeLineForeground"]
46 bg_color = config["/UI/NCurses/Color/ModeLineBackground"]
47 Ncurses::init_pair(MODELINE_PAIR,
48 COLOR_TABLE[fg_color],
49 COLOR_TABLE[bg_color])
50 end
51 end
52 end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26