php把一个颜色变深的函数 程序员文章站 2022-05-26 14:36:04 ... 这个php函数可以把指定的颜色变得更深一些 function ColorDarken($color, $dif=20){ $color = str_replace('#', '', $color); if (strlen($color) != 6){ return '000000'; } $rgb = ''; for ($x=0;$x $c = hexdec(substr($color,(2*$x),2)) - $dif; $c = ($c $rgb .= (strlen($c) } return '#'.$rgb; } //范例: for ($x=1; $x // Start color: $c = ColorDarken('#FF481D', ($x * 3)); print ".\n"; } 复制代码 php 相关标签: php把一个颜色变深的函数 上一篇: Windows 2000下PHP服务器安装攻略 下一篇: Thinkphp搜索时首页分页和搜索页保持条件分页的方法_php实例 推荐阅读 再来一个一个把字符串按php代码高亮显示的函数 给定一个颜色值,怎么把它转换成一个深一点的值? 给定一个颜色值,如何把它转换成一个深一点的值 php把一个颜色变深的函数示例开发详解 php把一个颜色变深的函数 php把一个颜色变深的函数示例开发详解 php把格式化的字符串写入一个变量中函数sprintf() php把一个或多个数组合并为一个数组的函数array_merge_recursive() php把一个或多个数组合并为一个数组的函数array_merge_recursive() php把格式化的字符串写入一个变量中函数sprintf()