UI-Various

 view release on metacpan or  search on metacpan

lib/UI/Various/core.pm  view on Meta::CPAN

This function returns the full name of the currently used user interface,
e.g. to access its methods.

=head3 returns:

full name of UI

=cut

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
sub ui(;$)
{
    return $UI->{ui};
}

#########################################################################

=head2 B<fatal> - abort with error message

    fatal($message_id, @message_data);

lib/UI/Various/widget.pm  view on Meta::CPAN


use constant COLOUR => ({black	=> '000000',
			 blue	=> '0000ff',
			 cyan	=> '00ffff',
			 green	=> '00ff00',
			 magenta=> 'ff00ff',
			 red	=> 'ff0000',
			 white	=> 'ffffff',
			 yellow	=> 'ffff00'});

sub bg($;$)
{
    return access('bg',
		  sub{
		      $_ = lc($_);
		      defined ${\COLOUR}->{$_}  and  $_ = ${\COLOUR}->{$_};
		      unless (m/^[0-9a-f]{6}$/)
		      {
			  error('parameter__1_must_be_a_valid_colour', 'bg');
			  $_ = '000000';
		      }

lib/UI/Various/widget.pm  view on Meta::CPAN

=item fg [rw, optional]

the background colour of a UI element can either be the name of the basic 8
colours (black, blue, cyan, green, magenta, red, white, yellow) or a numeric
code of 6 hexadecimal digits for the RRGGBB value.

See C<bg> above for the colour restrictions of the terminal UIs.

=cut

sub fg($;$)
{
    return access('fg',
		  sub{
		      $_ = lc($_);
		      defined ${\COLOUR}->{$_}  and  $_ = ${\COLOUR}->{$_};
		      unless (m/^[0-9a-f]{6}$/)
		      {
			  error('parameter__1_must_be_a_valid_colour', 'fg');
			  $_ = '000000';
		      }



( run in 5.012 seconds using v1.01-cache-2.11-cpan-524268b4103 )