NAME
Colouring::In - color or colour.
VERSION
Version 0.16
SYNOPSIS
use Colouring::In;
my $black = Colouring::In->new('#000000');
$black->toHEX # #000
$black->toHEX(1) # #000000
$black->toRGB # rgb(0,0,0)
$black->toRGBA # rgba(0,0,0,1)
$black->toHSL # hsl(0,0%,0%)
$black->toHSV # hsv(0,0%,0%)
my $white = $black->lighten('100%');
my $black = $white->darken('100%');
my $transparent = $black->fadeout('100%');
$black = $transparent->fadein('100%');
...
use Colouring::In qw/lighten darken/;
my $white = lighten('#000', '100%');
my $black = darken('#fff', '100%');
my $transparent = fade('#fff', '0%');
my $transparent = fadeout('#fff', '100%');
my $colour = fadein('rgba(125,125,125,0'), '100%');
Instantiate
new
Instantiate an Colouring::In Object using a supported colour formated string or RGBA array reference.
my $colour = Colouring::In->new('hsla(0, 0%, 100%, 0.3)');
my $colour = Colouring::In->new([255, 255, 255, 0.3]);
rgb
Instantiate an Colouring::In Object opaque colour from decimal red, green and blue (RGB) values.
my $colour = Colouring::In->rgb(0, 0, 0);
rgba
Instantiate an Colouring::In Object transparent colour from decimal red, green, blue and alpha (RGBA) values.
my $colour = Colouring::In->rgb(0, 0, 0, 0.5);
hsl
Instantiate an Colouring::In Object opaque colour from hue, saturation and lightness (HSL) values.
my $colour = Colouring::In->hsl(0, 0%, 100%);
hsla
Instantiate an Colouring::In Object tranparent colour from hue, saturation, lightness and alpha (HSLA) values.
my $colour = Colouring::In->hsla(0, 0%, 100%, 1);
Methods
lighten
Increase the lightness of the colour.
my $lighter = $colour->lighten('50%');
darken
Decrease the lightness of the colour.
my $darken = $colour->darken('50%');
fade
Set the absolute opacity of the colour.
my $fade = $colour->fade('50%');
fadeout
Decrease the opacity of the colour.
my $fadeout = $colour->fadeout('10%');
fadein
Increase the opacity of the colour.
my $fadein = $colour->fadein('5%');
toCSS
Returns either an rgba or hex colour string based on whether the alpha value is set.
my $string = $colour->toCSS;
toRGB
Returns an opaque colour string from decimal red, green and blue (RGB) values.
my $string = $colour->toCSS;
toRGBA
Returns an transparent colour string from decimal red, green, blue and alpha (RGBA) values.
my $string = $colour->toRGBA;
toHEX
Returns an opaque colour string from decimal red, green and blue (RGB) values.
my $string = $colour->toHEX;
toHSL
Returns an opaque colour string from hue, saturation and lightness (HSL) values.
my $string = $colour->toHSL;
toHSV
Returns an opaque colour string from hue, saturation and value (HSV) values.
my $string = $colour->toHSV;
colour
Returns an array containeing the red, green and blue (RGB) values.
my $string = $colour->colour;
AUTHOR
Robert Acock, <thisusedtobeanemail at gmail.com>
BUGS
Please report any bugs or feature requests to bug-colouring-in at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Colouring-In. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Colouring::In
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2017 Robert Acock.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:
http://www.perlfoundation.org/artistic_license_2_0
Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.
If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.
This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.
This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.