本文整理汇总了PHP中Color::lighten方法的典型用法代码示例。如果您正苦于以下问题:PHP Color::lighten方法的具体用法?PHP Color::lighten怎么用?PHP Color::lighten使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Color
的用法示例。
在下文中一共展示了Color::lighten方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Color
function query_parsed_init()
{
global $gantry;
$browser = $gantry->browser;
// Colors
$linkColor = new Color($gantry->get('linkcolor'));
$css = 'a, ul.menu li .separator {color:' . $gantry->get('linkcolor') . ';}';
$css .= '.button, .readon, .readmore, button.validate, #member-profile a, #member-registration a, .formelm-buttons button, .btn-primary {border-color:' . $linkColor->darken('20%') . ';}';
// Gradients
$css .= '.button, .readon, .readmore, button.validate, #member-profile a, #member-registration a, .formelm-buttons button, .btn-primary {background-color: ' . $linkColor->lighten('4%') . '; ' . $this->_createGradient('top', $linkColor->lighten('4%'), '1', '0%', $linkColor->darken('9%'), '1', '100%') . '}' . "\n";
$css .= '.button:hover, .readon:hover, .readmore:hover, button.validate:hover, #member-profile a:hover, #member-registration a:hover, .formelm-buttons button:hover, .btn-primary:hover {background-color: ' . $linkColor->lighten('10%') . '; ' . $this->_createGradient('top', $linkColor->lighten('10%'), '1', '0%', $linkColor->darken('3%'), '1', '100%') . '}' . "\n";
$css .= '.button:active, .readon:active, .readmore:active, button.validate:active, #member-profile a:active, #member-registration a:active, .formelm-buttons button:active, .btn-primary:active {background-color: ' . $linkColor->darken('2%') . '; ' . $this->_createGradient('top', $linkColor->darken('2%'), '1', '0%', $linkColor->lighten('8%'), '1', '100%') . '}' . "\n";
// Logo
$css .= $this->buildLogo();
$this->_disableRokBoxForiPhone();
$gantry->addInlineStyle($css);
if ($gantry->get('layout-mode') == "responsive") {
$gantry->addLess('mediaqueries.less', 'mediaqueries.css', 9);
}
if ($gantry->get('layout-mode') == "960fixed") {
$gantry->addLess('960fixed.less');
}
if ($gantry->get('layout-mode') == "1200fixed") {
$gantry->addLess('1200fixed.less');
}
// add inline css from the Custom CSS field
$gantry->addInlineStyle($gantry->get('customcss'));
}
示例2: steelmeter_attributes
/**
* Get attributes for steel meter shortcodes.
*
* @return string $attributes The attributes of the value queryed by the shortcode.
* @since 2.2.0
*/
public function steelmeter_attributes($attributes)
{
require_once LWS_INCLUDES_DIR . 'phpcolors/Color.php';
$result = array();
$values = $this->steelmeter_value($attributes, true);
$result['minValue'] = $values['min'];
$result['maxValue'] = $values['max'];
$min = $values['min'];
$max = $values['max'];
if (strpos($attributes['design'], 'windcompass') !== false) {
$min = 0;
$max = 360;
}
$digital = strpos($attributes['design'], 'digital') > -1;
if (strpos($attributes['design'], '-1-4') !== false) {
$result['gaugeType'] = 'steelseries.GaugeType.TYPE1';
}
if (strpos($attributes['design'], '-2-4') !== false) {
$result['gaugeType'] = 'steelseries.GaugeType.TYPE2';
}
if (strpos($attributes['design'], '-3-4') !== false) {
$result['gaugeType'] = 'steelseries.GaugeType.TYPE3';
}
if (strpos($attributes['design'], '-4-4') !== false) {
$result['gaugeType'] = 'steelseries.GaugeType.TYPE4';
}
if (strpos($attributes['design'], '-left') !== false) {
$result['orientation'] = 'steelseries.Orientation.WEST';
}
if (strpos($attributes['design'], '-right') !== false) {
$result['orientation'] = 'steelseries.Orientation.EAST';
}
if (strpos($attributes['design'], 'windcompass-modern') !== false) {
$result['pointSymbolsVisible'] = false;
}
$result['frameDesign'] = 'steelseries.FrameDesign.' . $attributes['frame'];
$result['backgroundColor'] = 'steelseries.BackgroundColor.' . $attributes['background'];
if ($attributes['orientation'] != 'AUTO') {
$result['tickLabelOrientation'] = 'steelseries.TickLabelOrientation.' . $attributes['orientation'];
}
$result['pointerType'] = 'steelseries.PointerType.' . $attributes['main_pointer_type'];
$result['pointerTypeLatest'] = 'steelseries.PointerType.' . $attributes['main_pointer_type'];
$result['pointerColor'] = 'steelseries.ColorDef.' . $attributes['main_pointer_color'];
$result['pointerTypeAverage'] = 'steelseries.PointerType.' . $attributes['aux_pointer_type'];
$result['pointerColorAverage'] = 'steelseries.ColorDef.' . $attributes['aux_pointer_color'];
$knob = explode('-', $attributes['knob']);
$result['knobType'] = 'steelseries.KnobType.' . $knob[0];
$result['knobStyle'] = 'steelseries.KnobStyle.' . $knob[1];
if ($attributes['lcd'] == 'NONE') {
$result['lcdVisible'] = false;
} else {
$result['lcdColor'] = 'steelseries.LcdColor.' . $attributes['lcd'];
}
if ($attributes['alarm'] != 'NONE') {
$result['userLedVisible'] = true;
$result['userLedColor'] = 'steelseries.LedColor.' . $attributes['alarm'];
}
if ($attributes['trend'] != 'NONE') {
$result['trendVisible'] = true;
$result['trendColors'] = '[steelseries.LedColor.' . $attributes['trend'] . ', steelseries.LedColor.' . $attributes['trend'] . ', steelseries.LedColor.' . $attributes['trend'] . ']';
}
if ($attributes['minmax'] == 'cursor') {
$result['minMeasuredValueVisible'] = true;
$result['maxMeasuredValueVisible'] = true;
}
if ($attributes['index_style'] != 'NONE') {
$style = explode('-', $attributes['index_style']);
$tcolor = new Color(Color::nameToHex($attributes['index_color']));
$alpha = 0;
$lighten = 1;
if (isset($style[1])) {
switch (strtolower($style[1])) {
case 'translucent':
$alpha = 0.1;
if ($tcolor->isVeryDark()) {
$lighten = 40;
} else {
$lighten = 20;
}
break;
case 'liquid':
$alpha = 0.25;
if ($tcolor->isVeryDark()) {
$lighten = 28;
} else {
$lighten = 15;
}
break;
case 'soft':
$alpha = 0.5;
if ($tcolor->isVeryDark()) {
$lighten = 15;
} else {
$lighten = 10;
//.........这里部分代码省略.........
示例3: css
/**
* Set the (inline) css for the widget rendering.
*
* @param array $instance An array containing settings for the widget.
* @param string $uid Identifiant of the widget.
* @param boolean $flat_design Enabling flat design mode.
* @since 2.0.0
*/
public function css($instance, $uid, $flat_design)
{
require_once LWS_INCLUDES_DIR . 'phpcolors/Color.php';
try {
$maxwidth = round($instance['width']);
} catch (Exception $ex) {
$maxwidth = 0;
}
$txt_color = $instance['txt_color'];
$color = new Color($instance['bg_color']);
$opacity = (11 - $instance['bg_opacity']) / 11;
if ($opacity < 0.1) {
$opacity = 0;
}
if ($color->isDark()) {
$gradient = $color->makeGradient(20);
} else {
$gradient = $color->makeGradient(15);
}
$border = new Color($gradient['light']);
$icon = new Color($txt_color);
if ($border->isDark()) {
$ico_color = '#' . $icon->darken(1);
$unit_color = '#' . $icon->lighten(1);
} else {
$ico_color = '#' . $icon->lighten(1);
$unit_color = '#' . $icon->darken(1);
}
if ($color->isDark()) {
if ($icon->isDark()) {
$bcc = $icon->darken(4);
} else {
$bcc = $icon->darken(30);
}
} else {
if ($icon->isDark()) {
$bcc = $icon->lighten(4);
} else {
$bcc = $icon->lighten(20);
}
}
if ($flat_design) {
$gradient_dark = Color::hexToRgbString($instance['bg_color'], $opacity);
$gradient_light = Color::hexToRgbString($instance['bg_color'], $opacity);
$border_color1 = '#' . $bcc;
$border_color2 = '#' . $bcc;
} else {
$gradient_dark = Color::hexToRgbString('#' . $gradient['dark'], $opacity);
$gradient_light = Color::hexToRgbString('#' . $gradient['light'], $opacity);
$border_color1 = '#' . $border->darken();
$border_color2 = '#' . $border->darken(16);
}
$id = $uid;
$shadows = !$flat_design;
$borders = $instance['show_borders'];
include LWS_PUBLIC_DIR . 'partials/live-weather-station-widget-ephemeris-display-css.php';
}
示例4: Color
}
if (!$nav_icon_hover_color) {
$nihc = new Color($nav_bg);
if ($nihc->isLight()) {
$nav_icon_hover_color = '#' . $nihc->darken(10);
} else {
$nav_icon_hover_color = '#' . $nihc->lighten(10);
}
}
if (!$link_hover_color) {
$lhc = new Color($link_color);
$lcolor = $lhc->getHex();
if ($lhc->isLight($lcolor, 75)) {
$link_hover_color = '#' . $lhc->darken(5);
} else {
$link_hover_color = '#' . $lhc->lighten(5);
}
}
// Convert $bg_image_options into css
switch ($bg_image_option) {
case "stretch":
$background_size_img = "100%";
break;
case "cover":
$background_size_img = "cover";
break;
case "repeat":
$background_size_img = "auto";
break;
case "contain":
$background_size_img = "contain";
示例5: testShouldLigtenColor
public function testShouldLigtenColor()
{
$color = new Color('000');
$this->assertEquals(new Color('222'), $color->lighten(34));
$this->assertEquals(new Color('fff'), $color->lighten(300));
}
示例6: generate_css_color
public static function generate_css_color($selector, $style, $mod_name, $color_offset = 0, $opacity = 1, $before = '', $after = '')
{
$mod = get_theme_mod($mod_name);
if (!empty($mod)) {
$value = $mod;
if (substr($value, 0, 1) != '#') {
$value = '#' . $value;
}
$color = new Color($value);
if ($color_offset > 0) {
$value = '#' . $color->lighten(abs($color_offset));
} elseif ($color_offset < 0) {
$value = '#' . $color->darken(abs($color_offset));
}
if (abs($opacity) < 1) {
$rgb = new Color($value);
$rgb = $rgb->getRgb();
$value = 'rgba( ' . $rgb['R'] . ', ' . $rgb['G'] . ', ' . $rgb['B'] . ', ' . $opacity . ' )';
}
echo $selector . '{ ' . $style . ': ' . $before . ' ' . $value . ' ' . $after . ' }';
}
}