1. Go to this page and download the library: Download zhb/weather-gradient library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zhb / weather-gradient example snippets
$colors = [
0 => [59, 130, 246], // blue
30 => [239, 68, 68], // red
];
// create a gradient from given thresholds
$gradient = Gradient::fromColors($colors);
// get the RGB color at a specific gradient position
$color = $gradient->colorAtGradientPosition(18);
// print the color
echo $color; // rgb(167, 92, 139)
// or get r, g, b values
$r = $color->getR();
$g = $color->getG();
$b = $color->getB();