View unanswered posts | View active topics It is currently Fri Mar 01, 2024 2:45 pm

Reply to topic  [ 1 post ] 
Author Message
New pChart user
New pChart user

Joined: Fri Oct 21, 2011 6:30 pm
Posts: 3
Post pColor
Maybe there already is some helper for colors. But I needed some helper to parse hex colors and was able to get different prefix and sufixed that pChart uses.

So it works like this:
$mycolor = new pColor('#ff00ff');
// will output ARRAY('R'=>255,'G'=>0,'B'=>255,'Alpha'=>100)

// will output ARRAY('BorderR'=>255,'BorderG'=>0,'BorderB'=>255)
// Arguments are $prefix, $sufix, $includeAlpha

There are also some helpers to make colors brighter/darker and ability to copy object in a simple maner:
$chartcolor = new pColor('#ff44ff');
// And if we need a darker border
$chartbordercolor = $chartcolor->copy()->darker(0.3);

A last example to draw a scale with different variations of the same base color:
$basecolor = new pColor('#ff4422');

   + $basecolor->copy()->brighter()->get('Axis','',false)
   + $basecolor->copy()->brighter(0.9)->get('Grid','',false)

Hope this always helps someone :D

Attachments: [1.13 KiB]
Downloaded 846 times
Thu Oct 27, 2011 1:33 pm
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: