Home PHP Libraries Other libraries Operation color darkening PHP class
Operation color darkening PHP class
<?php
function ColorDarken($color, $dif=20){
  $color = str_replace('#', '', $color);
  if (strlen($color) != 6){ return '000000'; }
  $rgb = '';
  for ($x=0;$x<3;$x++){
    $c = hexdec(substr($color,(2*$x),2)) - $dif;
    $c = ($c < 0) ? 0 : dechex($c);
    $rgb .= (strlen($c) < 2) ? '0'.$c : $c;
  }
  return '#'.$rgb;
}
//范例:
for ($x=1; $x < 20; $x++){
  // Start color:
  $c = ColorDarken('#FF481D', ($x * 3));
  print "<div style='background-color: $c; color: $c; font-size: 50%; padding: 0px;'>.</div>\n";
}
?>

This is a PHP class for operating the color to become darker. Friends who need it can download it and use it.

Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

PHP value mysql operation class, php value mysql PHP value mysql operation class, php value mysql

06 Jul 2016

PHP value mysql operation class, php value mysql. PHP value mysql operation class, php value mysql ?php/** * Created by PhpStorm. * User: Administrator * Date: 2016/6/27 * Time: 18:55 */Class Mysqls{ private $table; //table private $opt; public f

How Do I Link Static Libraries That Depend on Other Static Libraries? How Do I Link Static Libraries That Depend on Other Static Libraries?

13 Dec 2024

Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...

PHP value mysql operation class, php value mysql_PHP tutorial PHP value mysql operation class, php value mysql_PHP tutorial

12 Jul 2016

PHP value mysql operation class, php value mysql. PHP value mysql operation class, php value mysql ?php/** * Created by PhpStorm. * User: Administrator * Date: 2016/6/27 * Time: 18:55 */Class Mysqls{ private $table; //table private $opt; public f

Complete example of PHP database operation Helper class, phphelper_PHP tutorial Complete example of PHP database operation Helper class, phphelper_PHP tutorial

12 Jul 2016

A complete example of PHP database operation Helper class, phphelper. A complete example of the PHP database operation Helper class, phphelper This article describes the PHP database operation Helper class through examples. Share it with everyone for your reference, the details are as follows: PHP operation database is divided into several

PHP operation FTP class (upload, download, move, create, etc.), phpftp_PHP tutorial PHP operation FTP class (upload, download, move, create, etc.), phpftp_PHP tutorial

12 Jul 2016

PHP operates FTP classes (upload, download, move, create, etc.), phpftp. PHP operates FTP classes (upload, download, move, create, etc.), phpftp This article provides a detailed introduction to PHP operating FTP classes, php implements FTP upload, FTP download, FTP move, FTP creation, etc. for your reference

How to Silence TensorFlow\'s Debugging Output? How to Silence TensorFlow\'s Debugging Output?

28 Oct 2024

Suppression of Tensorflow Debugging OutputTensorflow prints extensive information about loaded libraries, found devices, and other debugging data...

See all articles