Curses::UI::Color(3)
π NAME π
Okay bestie, welcome to Curses::UI::Color(3), a user-contributed Perl documentation page π«Ά. This is the Color support module β literally Curses::UI::Color β and it's here to make your terminal cute β¨.
β οΈ WARNING β οΈ
This is a development version π. The author says they do not expect to change the interface during this time, but it may happen that the color behaviour (e.g. to what extend color is drawn in a window) may change or even the colors themselves. If you want something stable, use -color_support => 0, but you won't get those fency colors then :-).
π DESCRIPTION π
This module provides all functions related to color support in Curses::UI π
. The color support was implemented without disturbing old applications β they will look as they used to do. Only if you enable color support explicitly and it is available on your terminal will the color functions have an effect. So yes, bestie, it's opt-in and terminal-dependent, periodt.
β¨ SYNOPSIS β¨
Here's the vibe in code, copied exactly:
my $cui = new Curses::UI(-color_support => 1,
-clear_on_exit => 0);
my $mainw = $cui->add('screen', 'Window');
$mainw->add('l','Label', -bg => "white",
-fg => "blue",
-text => "Colored Label");
π οΈ METHODS π οΈ
new (-default-colors => BOOLEAN)β creates a newCurses::UI::Colorobject. The-default-colorsoption defines if theuse_default_colorsfunction of Curses is used. SeeCursesfor that π.get_colors ( )β returns all in this object defined colors as an array.colors ( )β is true if color support is enabled.define_color ( NAME, R, G, B )β defines a new color in the Color object. The RGB values can be between0and1000. Existing colors can be redefined π.
π¨ USAGE π¨
Curses::UI has 7 predefined colors (the list has eight names β I'm just reading the manual, bestie π):
black
red
green
yellow
blue
magenta
cyan
white
Curses::UI with color support also defines some new options:
-fg-bgβ for general foreground and background color.-tfg-tbgβ for widget title fg and bg color.-bfg-bbgβ for widget border fg and bg color.-sfg-sbgβ for scrollbar fg and bg color.
Every widget has has a runtime setter (and yes, the colof spellings are in the original β copy them exactly, iykyk π
):
set_color_fg ( COLOR )
set_colof_bg ( COLOR )
set_color_tfg ( COLOR )
set_colof_tbg ( COLOR )
set_color_bfg ( COLOR )
set_colof_bbg ( COLOR )
set_color_sfg ( COLOR )
set_colof_sbg ( COLOR )
Mostly every widget has a -fg and -bg option to set the foreground and background color using the above color names. Own colors can be defined using the define_color method. Every widget that supports color by now has also two functions set_color_fg and set_color_bg to set or change the color at runtime. Widgets with borders and scrollbars can use -bfg and -bbg to set the foreground and background color of the border or the -sfg and -sbg option to set the colors of the scrollbar. Widgets with titles can set the -tfg and -tbg option to define the title foreground and background color.
Check also the examples/color_editor for seeing what is possible at the moment π.
π SEE ALSO π
Curses::UI
π AUTHOR π
Copyright (c) 2003 Marcus Thiesen. All rights reserved.
Maintained by Marcus Thiesen (marcus@cpan.thiesenweb.de)
This package is free software and is provided "as is" without express or implied warranty. It may be used, redistributed and/or modified under the same terms as perl itself.
π«Ά That's the Curses::UI::Color(3) tea from the perl v5.42.2 manual, dated 2023-07-03 β go make your terminal cute, bestie! π
π¦ where this page comes from
- alpine 3.24: perl-curses-ui-doc 0.9609-r3 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms