cebe / color-nick
A simple PHP lib that can color nick names to make them distinguishable in a chat room.
1.0.0
2014-10-27 01:18 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- fzaninotto/faker: ~1.4.0
This package is auto-updated.
Last update: 2024-12-05 19:03:53 UTC
README
A simple PHP lib that can color nick names to make them distinguishable in a chat room.
Each color is unique to the name so each name keeps its color regardless of the time, system
or whatever circumstances. This is done using a sha1
hash on the name and taking the first 7
characters in it hex representation to calculate the color.
Requirements
PHP 5.4 or higher.
Installation
Using Composer:
composer require cebe/color-nick
Usage
<?php use cebe\colornick\Color; require(__DIR__ . '/vendor/autoload.php'); $color = Color::calculateColor($name);
See example.php for a working example. Here is a screenshot of the output:
License
MIT, see LICENSE file for more details.