Fl

 view release on metacpan or  search on metacpan

lib/Fl/Color.pod  view on Meta::CPAN

export_constant("FL_DARK_YELLOW",       "color");
export_constant("FL_DARK_BLUE",         "color");
export_constant("FL_DARK_MAGENTA",      "color");
export_constant("FL_DARK_CYAN",         "color");
export_constant("FL_WHITE",             "color");

=pod

The following functions are also imported with the C<:color> tag.

=over

=item fl_inactive(...)

    my $inactive_red = fl_inactive(FL_RED);

Returns the inactive, dimmed version of the given color.

=cut

xs {name        => 'fl_inactive',
    definitions => [{required => [['Fl_Color', 'color']],
                     returns  => 'Fl_Color'
                    }
    ],
    export => [qw[color]]
};

=pod

=item fl_contrast(...)

    my $fg = FL_RED;
    my $bg = FL_BLACK;
    my $color = fl_contrast($fg, $bg);

Returns a color that contrasts with the background color.

This will be the foreground color if it contrasts sufficiently with the
background color. Otherwise, returns C<FL_WHITE> or C<FL_BLACK> depending on
which color provides the best contrast.

=cut

xs {name        => 'fl_contrast',
    definitions => [{required => [['Fl_Color', 'fg'], ['Fl_Color', 'bg']],
                     returns => 'Fl_Color'
                    }
    ],
    export => [qw[color]]
};

=pod

=item fl_color_average(...)

    my $average = fl_color_average(FL_RED, FL_BLUE, .14);

Returns the weighted average color between the two given colors.

The red, green and blue values are averages using the following formula:

    color = color1 * weight  + color2 * (1 - weight)

Thus, a weight value of 1.0 will return the first color, while a value of 0.0
will return the second color.

=cut

xs {name        => 'fl_color_average',
    definitions => [{required => [['Fl_Color', 'color1'],
                                  ['Fl_Color', 'color2'],
                                  ['double',   'weight']
                     ],
                     returns => 'Fl_Color'
                    }
    ],
    export => [qw[color]]
};

=pod

=item fl_lighter(...)

    my $light_red = fl_lighter(FL_RED);

Returns a lighter version of the specified color.

=cut

xs {name        => 'fl_lighter',
    definitions => [{required => [['Fl_Color', 'color']],
                     returns  => 'Fl_Color'
                    }
    ],
    export => [qw[color]]
};

=pod

=item fl_darker(...)

    my $dark_red = fl_darker(FL_RED);

Returns a darker version of the specified color.

=cut

xs {name        => 'fl_darker',
    definitions => [{required => [['Fl_Color', 'color']],
                     returns  => 'Fl_Color'
                    }
    ],
    export => [qw[color]]
};

=pod

=item fl_rgb_color(...)

    my $color = fl_rgb_color(100, 200, 180);



( run in 1.590 second using v1.01-cache-2.11-cpan-437f7b0c052 )