-
-
31 May 2017 15:09:54 UTC
- Distribution: Data-Faker-Colour
- Module version: 0.001
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Clone repository
- Issues
- Testers (345 / 0 / 62)
- Kwalitee
Bus factor: 0- 78.57% Coverage
- License: perl_5
- Perl: v5.14.0
- Activity
24 month- Tools
- Download (4.76KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
Data::Faker::Colour - Generate random colours
SYNOPSIS
use Data::Faker::Colour; local $, = ' '; my $f = Data::Faker::Colour->new; say 'Random colour: ', $f->colour_hex; say 'Three random colours of 60% lightness: ', $f->colour_hsluv_hex(3, -1, -1, 60); say 'A colour with 70% saturation, in CSS format: ', $f->colour_hsluv_css(1, -1, 70); say '5 colours with hue 120 and lightness 45%: ', $f->colour_hsluv_hex(5, 150, -1, 45);
DESCRIPTION
This module is a plugin for Data::Faker for generating random colours. It uses the HSLuv colour space to permit generation of colours with specific hue, saturation, or lightness values. One use case would be generating colour schemes.
It is recommended to use this without Data::Faker, as Data::Faker does not currently pass arguments to methods.
DATA PROVIDERS
- colour([$cnt])
-
Generate $cnt (default 1) random colours. Returns a list of 3-element arrayrefs, representing the R, G, and B components, each ranging 0-255.
- colour_hex([$cnt])
-
As above, but returns a list of strings like
#rrggbb
. - colour_css([$cnt])
-
As above, but returns a list of strings like
rgb(r, g, b)
. - colour_hsluv([$cnt, $H, $S, $L])
-
Generates $cnt (default 1) random colours using the HSLuv colour space. You can specify your desired hue, saturation and/or lightness, and all generated colours will have that hue/saturation/lightness.
Set $H, $S, $L to a positive value to request a specific hue/saturation/lightness, or to -1 for a randomly chosen one. They all default to -1.
- colour_hsluv_hex([$cnt, $H, $S, $L])
- colour_hsluv_css([$cnt, $H, $S, $L])
-
As above but with hex/css output.
color
can be substituted forcolour
in any of the methods above.SEE ALSO
Data::Faker, Convert::Colour, Convert::Colour::HSLuv
AUTHOR
Marius Gavrilescu, <marius@ieval.ro>
COPYRIGHT AND LICENSE
Copyright (C) 2017 by Marius Gavrilescu
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.1 or, at your option, any later version of Perl 5 you may have available.
Module Install Instructions
To install Data::Faker::Colour, copy and paste the appropriate command in to your terminal.
cpanm Data::Faker::Colour
perl -MCPAN -e shell install Data::Faker::Colour
For more information on module installation, please visit the detailed CPAN module installation guide.