Closed carmenates09 closed 2 years ago
Saturation and Lighting should be a deecimal. In your case: var_dump(Color::hslToHex( array( 'H' => 50, 'S' => '.6', 'L' => '.7' ) ));
Ref: http://mexitek.github.io/phpColors/
On Mon, Feb 5, 2018 at 3:23 PM, Jose Carlos Ramos Carmenates < notifications@github.com> wrote:
I'm trying to convert a HSL to HEX:
var_dump(Color::hslToHex( array( 'H' => 50, 'S' => 60, 'L' => 70) )); or var_dump(Color::hslToHex( array( 'H' => 50, 'S' => '60%', 'L' => '70%' ) ));
Result:
string(38) "fffffffffff029e6fffffffffff5888210618e"
Any advise? Jose Carlos Ramos Carmenates
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mexitek/phpColors/issues/39, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfeekZdQV82dor6Yu5gVDMn_rpl6jqpks5tR42NgaJpZM4R6Qdr .
-- Arlo Carreon http://arlocarreon.com Web Developer
In the Color::hslToHex
method, the first argument is decimal string and it's the percent value
.
The second and third arguments are the floating number string and they indicate the percent value
.
The sample code snippets are as follows and it should make your code readability:
use Mexitek\PHPColors\Color;
Color::hslToHex(array( 'H' => 50, 'S' => '0.6', 'L' => '0.7' )); // "e0d185"
I'm trying to convert a HSL to HEX:
var_dump(Color::hslToHex( array( 'H' => 50, 'S' => 60, 'L' => 70) ));
orvar_dump(Color::hslToHex( array( 'H' => 50, 'S' => '60%', 'L' => '70%' ) ));
Result:
string(38) "fffffffffff029e6fffffffffff5888210618e"
Any advise? Jose Carlos Ramos Carmenates