本文整理汇总了PHP中Color::isDark方法的典型用法代码示例。如果您正苦于以下问题:PHP Color::isDark方法的具体用法?PHP Color::isDark怎么用?PHP Color::isDark使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Color
的用法示例。
在下文中一共展示了Color::isDark方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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';
}
示例2:
background: #<?php
echo $myBlack->getHex();
?>
;
color: <?php
echo $myBlack->isDark() ? "#EEE" : "#333";
?>
;
}
.testDiv3{
<?php
echo $myPurple->getCssGradient();
?>
color: <?php
echo $myPurple->isDark() ? "#EEE" : "#333";
?>
;
}
.testDiv3.plain{
background: #<?php
echo $myPurple->getHex();
?>
;
color: <?php
echo $myPurple->isDark() ? "#EEE" : "#333";
?>
;
}
</style>
<div class="clear"></div>