<?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.
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
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.
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.
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
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
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.
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
Hot Tools
PHP library for dependency injection containers
PHP library for dependency injection containers
A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking
Small PHP library for optimizing images
Small PHP library for optimizing images