In our daily development work, whether we are developing websites, shopping malls, or APPs, or whether it is front-end or back-end, color is an indispensable part. Then the color in the web page reflects the beauty of the web page, user experience and aesthetics. One of the important elements, so today we will introduce you to the detailed development example of a function that darkens a color in PHP!
First download the php function library we need to use for this course to darken a color: //m.sbmmt.com/xiazai/leiku/690
Download After completion, find the php class file we need, unzip it to our local directory, and create a new php file!
After completion, we need to call this class in the new php file and instantiate the class:
<?php include_once "codeyanse.php"; //引入类文件 //实现颜色加深 for ($x=1; $x < 20; $x++){ // Start color: $c = ColorDarken('#CC3333', ($x * 3)); print "<p style='background-color: $c; color: $c; font-size: 50%; padding: 0px;'>.</p>\n"; } ?>
Run the file and the result will be as shown below:
The above is the detailed content of Detailed explanation of the example development of a function that darkens a color in PHP. For more information, please follow other related articles on the PHP Chinese website!