Last active
August 29, 2015 14:08
-
-
Save richjenks/1636158f2547cb96c910 to your computer and use it in GitHub Desktop.
Returns a hue value between green and red for an int between 0–100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* heatmap | |
* | |
* Returns a hue value for HSL colors when given a level between 0–100 | |
* Will accept higher/lower values, but will be outside of heatmap range | |
* Converts a percentage to a number between 0—120 in reverse | |
* | |
* @param int $level Integer between 0–100 | |
* @return inst Integer between 0—120 | |
*/ | |
function heatmap($level) { return 120 - ( ( 120 / 100 ) * $level ); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment