1Curses::UI::Color(3) User Contributed Perl Documentation Curses::UI::Color(3)
2
3
4
6 Curses::UI::Color - Color support module
7
9 This is a development version. As I do not expect to change the
10 interface during this time it may happen that the color behaviour (e.g.
11 to what extend color is drawn in a window) may change or even the
12 colors themselves. If you want something stable, use -color_support =>
13 0 , but you won't get those fency colors then :-)
14
16 This module provides all functions related to color support in
17 Curses::UI. The color support was implemented without disturbing old
18 applications, they will look as they used to do. Only if you enable
19 color support explicitly and it is available on your terminal the color
20 functions will have an effect.
21
23 my $cui = new Curses::UI(-color_support => 1,
24 -clear_on_exit => 0);
25
26 my $mainw = $cui->add('screen', 'Window');
27
28 $mainw->add('l','Label', -bg => "white",
29 -fg => "blue",
30 -text => "Colored Label");
31
33 · new (-default-colors => BOOLEAN)
34
35 Creates a new Curses::UI::Color object, the option default colors
36 define if the use_default_colors function of Curses is used. See
37 Curses for that.
38
39 · get_colors ( )
40
41 Returns all in this object defined colors as an array
42
43 · colors ( )
44
45 Is true if color support is enabled.
46
47 · define_color ( NAME, R, G, B )
48
49 This function defines a new color in the Color object. The RGB
50 values can be between 0 and 1000. Existing colors can be redefined.
51
53 Curses::UI has 7 predefined colors:
54 black
55 red
56 green
57 yellow
58 blue
59 magenta
60 cyan
61 white
62
63 Curses::UI with color support also defines some new options:
64
65 -fg -bg for general foreground and background color.
66 -tfg -tbg for widget title fg and bg color
67 -bfg -bbg for widget border fg and bg color
68 -sfg -sbg for scrollbar fg and bg color
69
70 Every widget has has a runtime setter:
71 set_color_fg ( COLOR )
72 set_colof_bg ( COLOR )
73 set_color_tfg ( COLOR )
74 set_colof_tbg ( COLOR )
75 set_color_bfg ( COLOR )
76 set_colof_bbg ( COLOR )
77 set_color_sfg ( COLOR )
78 set_colof_sbg ( COLOR )
79
80 Mostly every widget has a -fg and -bg option to set the foreground and
81 background color using the above color names. Own colors can be defined
82 using the define_color method. Every widget that supports color by now
83 has also two functions set_color_fg and set_color_bg to set or change
84 the color at runtime. Widgets with borders and scrollbars can use -bfg
85 and -bbg to set the foreground and background color of the border or
86 the -sfg and -sbg option to set the colors of the scrollbar. Widgets
87 with titles can set the -tfg and -tbg option to define the title
88 foreground and background color.
89
90 Check also the examples/color_editor for seeing what is possible at the
91 moment.
92
94 Curses::UI
95
97 Copyright (c) 2003 Marcus Thiesen. All rights reserved.
98
99 Maintained by Marcus Thiesen (marcus@cpan.thiesenweb.de)
100
101 This package is free software and is provided "as is" without express
102 or implied warranty. It may be used, redistributed and/or modified
103 under the same terms as perl itself.
104
105
106
107perl v5.30.1 2020-01-29 Curses::UI::Color(3)