if ($red >= 0 && $red <= 255 && $green >= 0 && $green <= 255 && $blue >= 0 && $blue <= 255) {
        $rgb["red"] = $red;
        $rgb["green"] = $green;
        $rgb["blue"] = $blue;
        return $rgb;
    }
    return false;
}
// get and format input
$input = str_replace(";", "", $_GET["value"]);
// Input 1: three or six char HEX-Input
if (preg_match("/(^#?[0-9a-fA-F]{6}\$)/i", $input) != 0 || preg_match("/(^#?[0-9a-fA-F]{3}\$)/i", $input) != 0) {
    // HEX
    $hex = $input;
    // RGB
    $rgb = hexToRgb($hex);
    // CMYK
    $cmyk = rgbToCmyk($rgb["red"], $rgb["green"], $rgb["blue"], true);
    $result = true;
    // Input 2: RGB-Input
} else {
    if (preg_match("/^((rgb\\()?[\\s]?[0-9]{1,3}\\,[\\s]?[0-9]{1,3}\\,[\\s]?[0-9]{1,3}(\\))?)\$/i", $input) != 0) {
        $input = str_ireplace(array("RGB(", ")", " "), "", $input);
        // RGB
        $rgb = explode(",", $input);
        $rgb["red"] = intval($rgb[0]);
        unset($rgb[0]);
        $rgb["green"] = intval($rgb[1]);
        unset($rgb[1]);
        $rgb["blue"] = intval($rgb[2]);
        unset($rgb[2]);
示例#2
0
        // если hex цвет в полной форме - 6 символов
        list($red, $green, $blue) = array($color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5]);
    } elseif (strlen($cvet) == 3) {
        // если hex цвет в сокращенной форме - 3 символа
        list($red, $green, $blue) = array($color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2]);
    } else {
        return false;
    }
    // переводим шестнадцатиричные числа в десятичные
    $red = hexdec($red);
    $green = hexdec($green);
    $blue = hexdec($blue);
    // вернем результат
    return array('red' => $red - 10, 'green' => $green - 10, 'blue' => $blue - 10);
}
$rgb_main_bg = hexToRgb(fw_get_db_settings_option('main-background-color'));
$rgb_main_bg = 'rgb(' . $rgb_main_bg['red'] . ', ' . $rgb_main_bg['green'] . ', ' . $rgb_main_bg['blue'] . ')';
?>

<style>
#page-preloader {position: fixed;left: 0;top: 0;right: 0;bottom: 0;background: rgb(8, 8, 8);z-index: 9999;}
#page-preloader .spinner {width: 32px;height: 32px;position: absolute;left: 50%;top: 50%;background: url('/images/spinner.gif') no-repeat 50% 50%;margin: -16px 0 0 -16px;}
#home-hero,.site-footer, body { background-color: <?php 
echo fw_get_db_settings_option('main-background-color');
?>
 !important; }
.np-bot { color: <?php 
echo fw_get_db_settings_option('main-background-color');
?>
 !important; }
.sidr { background: <?php 
示例#3
0
$max = max($data);
if (!extension_loaded('gd')) {
    die('GD extension is not installed');
}
if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
    if ($_SERVER['HTTP_IF_NONE_MATCH'] == $hash) {
        header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
        die;
    }
}
$im = imagecreatetruecolor($w, $h);
list($r, $g, $b) = hexToRgb($back);
$bg = imagecolorallocate($im, $r, $g, $b);
list($r, $g, $b) = hexToRgb($line);
$fg = imagecolorallocate($im, $r, $g, $b);
list($r, $g, $b) = hexToRgb($fill);
$lg = imagecolorallocate($im, $r, $g, $b);
imagefill($im, 0, 0, $bg);
imagesetthickness($im, $t);
foreach ($data as $k => $v) {
    $v = $v > 0 ? round($v / $max * $h) : 0;
    $data[$k] = max($s, min($v, $h - $s));
}
$x1 = 0;
$y1 = $h - $data[0];
$line = array();
$poly = array(0, $h + 50, $x1, $y1);
for ($i = 1; $i < $count; $i++) {
    $x2 = $x1 + $step;
    $y2 = $h - $data[$i];
    array_push($line, array($x1, $y1, $x2, $y2));
示例#4
0
    return implode(",", $rgb);
    // returns the rgb values separated by commas
    // return $rgb; // returns an array with the rgb values
}
$cssSnippet = '.snippets-list li:before{
	font-family: "Glyphicons Halflings";
	content:"\\e165";
	font-size: 0.5em;
	float: right;
	line-height: 4.2em;
	margin-right: 10px;
}' . "\n";
foreach ($_GET['title'] as $key => $value) {
    $jsonArray["category"][$value] = array("title" => $_GET["title"][$key], "color" => $_GET["color"][$key], "prefix" => $_GET["prefix"][$key]);
    $prefixList = explode("|", $_GET["prefix"][$key]);
    foreach ($prefixList as $prefixKey => $prefixValue) {
        $cssSnippet .= '/*** ' . $_GET["title"][$key] . ' ***/' . "\n";
        $cssSnippet .= '.snippets-list li[id^="' . $prefixValue . '-"]:before{color: ' . $_GET["color"][$key] . ';}' . "\n";
        $cssSnippet .= '.snippets-list li[id^="' . $prefixValue . '-"].onChecked{background-color: rgba(' . hexToRgb($_GET["color"][$key]) . ',0.2) !important;}' . "\n";
        $cssSnippet .= '.snippets-list li[id^="' . $prefixValue . '-"].onFocus.onChecked{background-color: rgba(' . hexToRgb($_GET["color"][$key]) . ',0.1) !important;}' . "\n";
        $cssSnippet .= '.snippets-list li[id^="' . $prefixValue . '-"].onFocus.onOpen{background-color: rgba(' . hexToRgb($_GET["color"][$key]) . ',0.7) !important;}' . "\n";
        $cssSnippet .= '.snippets-list li[id^="' . $prefixValue . '-"].onOpen{background-color: ' . $_GET["color"][$key] . ' !important;}' . "\n";
        $cssSnippet .= '.c-cat-color-' . $_GET["title"][$key] . '{color: ' . $_GET["color"][$key] . ';}' . "\n";
        $cssSnippet .= '.bg-cat-color-' . $_GET["title"][$key] . '{background-color: ' . $_GET["color"][$key] . ';}' . "\n\n";
    }
}
$json = json_encode($jsonArray);
file_put_contents("../config.json", $json);
file_put_contents("../snippet-color.css", $cssSnippet);
$r = array('infotype' => "success", 'msg' => "ok", 'data' => '');
echo json_encode($r);
示例#5
0
文件: style.php 项目: rodbox/rodbox3
    } else {
        $r = hexdec(substr($hex, 0, 2));
        $g = hexdec(substr($hex, 2, 2));
        $b = hexdec(substr($hex, 4, 2));
    }
    $rgb = array($r, $g, $b);
    return implode(",", $rgb);
    // returns the rgb values separated by commas
    // return $rgb; // returns an array with the rgb values
}
$css = "";
foreach ($palette["key"] as $key => $color) {
    $colorValue = $color;
    $colorRef = $key + 1;
    $colorName = $palette["name"][$key];
    $css .= ".c-" . $colorName . $suf . ", \n";
    $css .= ".c-" . $colorRef . $suf . " {";
    $css .= "\tcolor : ";
    $css .= "rgb(" . hexToRgb($colorValue) . ") !important;";
    $css .= "}\n\n";
    $css .= ".bg-" . $colorName . $suf . ",\n";
    $css .= ".bg-" . $colorRef . $suf . " {";
    $css .= "background-color : ";
    $css .= "rgb(" . hexToRgb($colorValue) . ") !important;";
    $css .= "}\n\n";
    $css .= ".border-" . $colorRef . $suf . ",\n";
    $css .= ".border-" . $colorName . $suf . " { ";
    $css .= "border-color : rgb(" . hexToRgb($colorValue) . ") !important;";
    $css .= "}\n\n";
}
// $css .="</style>\n";