<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class ColorUtil { private static $colors = array('#FF7F50', '#DC143C', '#9932CC', '#B22222', '#DAA520', '#FF69B4', '#20B2AA', '#9370DB', '#3CB371', '#7B68EE', '#C71585', '#191970', '#FF8C00', '#DB7093', '#CD853F', '#BC8F8F', '#EE82EE', '#8B4513', '#FA8072', '#2E8B57', '#6B8E23', '#FF6347', '#ED3F14', '#4F7FF3', '#6A46BD', '#E9BD6C'); public static function randomColors() { return self::$colors; } public static function randomColor() { goto guZ3U; guZ3U: static $C6OV7 = 0; goto GfEfP; qeMnv: return $on8l0; goto hvdu1; GfEfP: $on8l0 = self::$colors[$C6OV7++ % count(self::$colors)]; goto qeMnv; hvdu1: } public static function pick($yIA_h) { $C6OV7 = abs(crc32($yIA_h)) % count(self::$colors); return self::$colors[$C6OV7]; } public static function adjust($sOWwD, $V5knL) { goto hgYx2; bNPDE: if (!preg_match('/^#[A-F0-9]{6}$/', $sOWwD)) { return $sOWwD; } goto KtKud; KtKud: $sOWwD = str_replace('#', '', $sOWwD); goto IkhyW; hgYx2: $sOWwD = strtoupper($sOWwD); goto bNPDE; iD9O3: $rGypx = hexdec($C_aDZ); goto d3w_Z; Qa_gy: $t1DWF = substr($sOWwD, 2, 2); goto hA6kj; TEyK7: return '#' . strtoupper(join('', array(str_pad(dechex($rGypx), 2, '0'), str_pad(dechex($dJy5a), 2, '0'), str_pad(dechex($cTI7y), 2, '0')))); goto c3dQZ; kjI8Y: $dJy5a = max(0, min(255, $dJy5a + $V5knL)); goto Uggym; ilfe1: $cTI7y = hexdec($uScib); goto GxyeM; Uggym: $cTI7y = max(0, min(255, $cTI7y + $V5knL)); goto TEyK7; hA6kj: $uScib = substr($sOWwD, 4, 2); goto iD9O3; GxyeM: $rGypx = max(0, min(255, $rGypx + $V5knL)); goto kjI8Y; d3w_Z: $dJy5a = hexdec($t1DWF); goto ilfe1; IkhyW: $C_aDZ = substr($sOWwD, 0, 2); goto Qa_gy; c3dQZ: } public static function hexToRgba($sOWwD) { goto onQts; onQts: $sOWwD = strtoupper($sOWwD); goto n3GNd; HAsZi: return 'rgba(0,0,0,1)'; goto ohqIO; n3GNd: if (preg_match('/^#([A-F0-9]{2})([A-F0-9]{2})([A-F0-9]{2})$/', $sOWwD, $YANPA)) { goto ZnULu; Fo60r: $cTI7y = hexdec($YANPA[3]); goto gVA5t; gVA5t: return "rgba({$rGypx},{$dJy5a},{$cTI7y},1)"; goto EdvBH; zYtyy: $dJy5a = hexdec($YANPA[2]); goto Fo60r; ZnULu: $rGypx = hexdec($YANPA[1]); goto zYtyy; EdvBH: } else { if (preg_match('/^#([A-F0-9]{2})([A-F0-9]{2})([A-F0-9]{2})([A-F0-9]{2})$/', $sOWwD, $YANPA)) { goto r9dzC; LhEkG: return "rgba({$rGypx},{$dJy5a},{$cTI7y},{$LoAcY})"; goto YhxAd; U0qVS: $dJy5a = hexdec($YANPA[2]); goto PfV7y; PfV7y: $cTI7y = hexdec($YANPA[3]); goto l_C1_; r9dzC: $rGypx = hexdec($YANPA[1]); goto U0qVS; l_C1_: $LoAcY = round(hexdec($YANPA[4]) / 255, 2); goto LhEkG; YhxAd: } } goto HAsZi; ohqIO: } public static function hexToRgbaArray($sOWwD) { goto WdD8_; rXH0Q: return $j9Bnb; goto vUF0G; WdD8_: $sOWwD = strtoupper($sOWwD); goto ilqhX; ilqhX: $j9Bnb = array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 1); goto Ud8Yu; Ud8Yu: if (preg_match('/^#([A-F0-9]{2})([A-F0-9]{2})([A-F0-9]{2})$/', $sOWwD, $YANPA)) { goto mlvuV; FF5Rf: $j9Bnb['b'] = hexdec($YANPA[3]); goto oBnvY; s68_3: $j9Bnb['g'] = hexdec($YANPA[2]); goto FF5Rf; mlvuV: $j9Bnb['r'] = hexdec($YANPA[1]); goto s68_3; oBnvY: } else { if (preg_match('/^#([A-F0-9]{2})([A-F0-9]{2})([A-F0-9]{2})([A-F0-9]{2})$/', $sOWwD, $YANPA)) { goto koDDQ; V1QtM: $j9Bnb['a'] = round(hexdec($YANPA[4]) / 255, 2); goto rUofR; qdx7g: $j9Bnb['g'] = hexdec($YANPA[2]); goto R83mp; R83mp: $j9Bnb['b'] = hexdec($YANPA[3]); goto V1QtM; koDDQ: $j9Bnb['r'] = hexdec($YANPA[1]); goto qdx7g; rUofR: } } goto rXH0Q; vUF0G: } }