2017 © Pedro Peláez
 

library hsluv

HSLuv / RGB / hex color conversion library

image

hsluv/hsluv

HSLuv / RGB / hex color conversion library

  • Tuesday, November 28, 2017
  • by hsluv
  • Repository
  • 1 Watchers
  • 6 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

HSLuv-php

Build Status, (*1)

Port to PHP (5.6+) from Python / JS of HSLuv (revision 4)., (*2)

To run the tests:, (*3)

composer install
./vendor/bin/phpunit

Usage

composer require "hsluv/hsluv"

From RGB / hex to HSLuv

// From hex upper / lowercase
$out = HSLuv::fromHex( '#fabada' );
$out = HSLuv::fromHex( '#FABADA' );

// From RGB (float) in 0.0 - 1.0 range
$out = HSLuv::fromRgb( 0.9803921568627451, 0.7294117647058823, 0.8549019607843137 );
$out = HSLuv::fromRgb( array( 0.9803921568627451, 0.7294117647058823, 0.8549019607843137 ) );

// From RGB (int) in 0 - 255 range
$out = HSLuv::fromRgbInt( 250, 186, 218 );
$out = HSLuv::fromRgbInt( 250.0, 186.0, 218.0 );
$out = HSLuv::fromRgbInt( array( 250, 186, 218 ) );
$out = HSLuv::fromRgbInt( array( 250.0, 186.0, 218.0 ) );

Returns HSLuv an array of float values ( H, S, L )., (*4)

From HSLuv to RGB / hex

Parameters are float H, S, L componets or an array., (*5)

// Rgb: returns array of (float) in 0.0 - 1.0 range
$out = HSLuv::toRgb( $h, $s, $l )
$out = HSLuv::toRgb( array( $h, $s, $l ) )

// Rgb: returns array if (int) in 0 - 255 range
$out = HSLuv::toRgbInt( $h, $s, $l )
$out = HSLuv::toRgbInt( array( $h, $s, $l ) )

// Hex: returns lowercase string including "#"
$out = HSLuv::toHex( $h, $s, $l )
$out = HSLuv::toRgb( array( $h, $s, $l ) )

Authors

  • Port by Carlos Cabo (carloscabo)
  • Support with tests and packaging (tasugo)
  • Original HSLuv author: Alexei Boronine (boronine)

The Versions

28/11 2017

dev-master

9999999-dev https://github.com/hsluv/hsluv-php

HSLuv / RGB / hex color conversion library

  Sources   Download

MIT

The Development Requires

color hsluv

21/02 2017

2.0.0

2.0.0.0 https://github.com/hsluv/hsluv-php

HSLuv / RGB / hex color conversion library

  Sources   Download

MIT

The Development Requires

color hsluv

19/02 2017

dev-change-namespace

dev-change-namespace https://github.com/hsluv/hsluv-php

HSLuv / rgb / hex color conversion library

  Sources   Download

MIT

The Development Requires

color hsluv

22/10 2016

1.0.1

1.0.1.0 https://github.com/husl-colors/husl-php

HUSL / rgb / hex color conversion library

  Sources   Download

MIT

The Development Requires

color husl

22/10 2016

1.0.2

1.0.2.0 https://github.com/husl-colors/husl-php

HUSL / rgb / hex color conversion library

  Sources   Download

MIT

The Development Requires

color husl

10/10 2016

1.0.0

1.0.0.0 https://github.com/carloscabo/husl-php-class

HUSL / rgb / hex color conversion library

  Sources   Download

MIT

The Development Requires

color husl