PHP Classes

PHP Color Codes Generator: Manipulate colors and generate color lists

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 161 All time: 8,954 This week: 55Up
Version License PHP version Categories
nickyx3_colortools 0.1GNU General Publi...5PHP 5, Graphics
Description 

Author

This class can manipulate colors and generate color lists.

It takes a base color and the number of colors to generate and it returns an array with the color values with an increasing hue value.

The class can also perform other color manipulation functions like:

- Converting a color from rgbHEX (RRGGBB) to array with decimal RGB values and vice-versa
- Convert color RGB to HSL and vice-versa
- Return black or white color based on the lightness of a given color

Innovation Award
PHP Programming Innovation award nominee
June 2018
Number 2
Some colors are more intense than others. To make a text more readable it is better that the text is displayed in a color that has a great contrast level with the background color. Usually the best colors to contrast are either black or white.

This class can determine whether the best color to contrast is black or white. It can also generate color lists that fade between to given colors.

Manuel Lemos
Picture of Nic Latyshev
Name: Nic Latyshev <contact>
Classes: 6 packages by
Country: Russian Federation Russian Federation
Age: 48
All time rank: 300682 in Russian Federation Russian Federation
Week rank: 158 Up6 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 2x

Documentation

ColorTools

This is Simple PHP Static Helper Class for RGB To HSL/HSL to RGB color manipulation and Color List Generator. Color lists may used for some task: generate unique colors with same lightness, generate paletes for ChartDirector and others

Class include few static function for color manipulations

Usage

<?php
	$count  = 8;
	$color  = '3d628e';
	$colors = ColorTools::ColorArrayGenerator($count,$color,true);
	print_r($colors);
?>

Array
(
	[0] => #3d628e
	[1] => #553d8e
	[2] => #8e3d8b
	[3] => #8e3d4e
	[4] => #8e693d
	[5] => #768e3d
	[6] => #3d8e40
	[7] => #3d8e7d
)

Use this colors for generate some color blocks <img src="https://raw.githubusercontent.com/NickyX3/ColorTools/master/result_preview.png">

CREDITS

Nic Latyshev <nickyx3@gmail.com>

This work is dual-licensed under the GPL v3 and the MIT license.


  Files folder image Files (3)  
File Role Description
Plain text file ColorTools.class.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Image file result_preview.png Data Auxiliary data

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:161
This week:0
All time:8,954
This week:55Up
User Comments (2)
Thats a very good class, great job ;-)
6 years ago (José Filipe Lopes Santos)
70%StarStarStarStar
Thats a very good class, great job ;-)
6 years ago (José Filipe Lopes Santos)
70%StarStarStarStar