search
HomePHP LibrariesOther librariesOperation 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

20May2017

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

19May2017

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 pdoPHP database operation class based on pdo

22Jun2018

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]

06Jan2017

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 classPHP implements a relatively complete database operation class

27Dec2016

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 classIntroduction to PHP zip compression package operation class

03Jul2018

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