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

[ftp operation class] 8 php ftp operation class libraries download [ftp operation class] 8 php ftp operation class libraries download

20 May 2017

FTP is a file transfer protocol that provides client access to the file server through the File Transfer Protocol (FTP). It is used to open, log in, and close connections, and is also used to upload, download, rename, delete, and obtain files on the server. file information. PHP Chinese website provides you with 8 practical PHP ftp operation libraries for your study and reference.

[Database Operation Class] 10 PHP database operation classes download [Database Operation Class] 10 PHP database operation classes download

19 May 2017

Database operation is an important part of the development process, and being proficient in database operation is an essential weapon for developers. PHP Chinese website provides you with various encapsulated PHP database operation libraries for you to download and learn.

PHP database operation class based on pdo PHP database operation class based on pdo

22 Jun 2018

This article mainly introduces PHP's pdo-based database operation class, which can implement basic database connections, additions, deletions, modifications, and connections, etc. It also supports operations on mysql, sqlserver, oracle and other databases. Friends in need can refer to the following

XML operation class implemented by PHP [XML Library] XML operation class implemented by PHP [XML Library]

06 Jan 2017

This article mainly introduces the XML operation class implemented by PHP, involving PHP's conversion, serialization, deserialization and other related operation skills for arrays and xml. Friends in need can refer to the following

PHP implements a relatively complete database operation class PHP implements a relatively complete database operation class

27 Dec 2016

This article mainly introduces PHP to implement a relatively complete database operation class, which can implement basic database connections, execute SQL statements, error prompts and other related skills. Friends in need can refer to it.

Introduction to PHP zip compression package operation class Introduction to PHP zip compression package operation class

03 Jul 2018

This article mainly introduces the PHP zip compression package operation class, and analyzes the PHP encapsulated zip file decompression, compression, recursive creation, reading and other related operations in the form of a complete example. Friends in need can refer to the following

See all articles