]>
iEval git - convert-color-hsluv.git/blob - lib/Convert/Color/HUSLp.pm
1 package Convert
::Color
::HUSLp
;
6 use parent qw
/Convert::Color::HUSL/;
8 use Convert
::Color
::XYZ
;
9 use Convert
::Color
::LUV
;
10 use Convert
::Color
::LCh
;
11 use List
::Util qw
/min/;
12 use Math
::Trig qw
/:pi/;
15 *_get_bounds
= *Convert
::Color
::HUSL
::_get_bounds
; ## no critic (ProtectPrivate)
18 our $VERSION = '0.002';
20 __PACKAGE__
->register_color_space('huslp');
22 sub _intersect_line_line
{
24 ($l1->[1] - $l2->[1]) / ($l2->[0] - $l1->[0])
27 sub _distance_from_pole
{
29 sqrt $x * $x + $y * $y
32 sub max_chroma_for_lh
{
36 my $x = _intersect_line_line
$_, [-1 / $m, 0];
37 _distance_from_pole
$x, $n + $x * $m
48 Convert::Color::HUSLp - a color value in the HUSLp color space
52 use Convert::Color::HUSLp;
53 my $reddish = Convert::Color::HUSLp->new(12.17705, 100, 53.23712);
54 my $greenish = Convert::Color::HUSLp->new('127.71501,100,87.73552');
57 my $bluish = Convert::Color->new('huslp:265.87432,100,32.30087');
59 say $reddish->H; # 12.17705
60 say $reddish->S; # 100
61 say $reddish->L; # 53.23712
62 say join ',', $bluish->hsl; # 265.87432,100,32.30087
66 Objects of this class represent colors in the HUSLp color space, revision 4.
72 =item Convert::Color::HUSLp->B<new>(I<$h>, I<$s>, I<$l>)
74 Construct a color from its components.
76 =item Convert::Color::HUSLp->B<new>(I<"$h,$s,$l">)
78 Construct a color from a string. The string should contain the three
79 components, separated by commas.
87 Accessors for the three components of the color.
91 Returns the three components as a list.
97 L<Convert::Color>, L<http://www.husl-colors.org/>
101 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
103 =head1 COPYRIGHT AND LICENSE
105 Copyright (C) 2015 by Marius Gavrilescu
107 This library is free software; you can redistribute it and/or modify
108 it under the same terms as Perl itself, either Perl version 5.20.2 or,
109 at your option, any later version of Perl 5 you may have available.
This page took 0.051293 seconds and 5 git commands to generate.