本文整理汇总了PHP中wc_light_or_dark函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_light_or_dark函数的具体用法?PHP wc_light_or_dark怎么用?PHP wc_light_or_dark使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_light_or_dark函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: woocommerce_light_or_dark
/**
* @deprecated
*/
function woocommerce_light_or_dark($color, $dark = '#000000', $light = '#FFFFFF')
{
return wc_light_or_dark($color, $dark, $light);
}
示例2: get_option
* the readme will list any important changes.
*
* @see https://docs.woothemes.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates/Emails
* @version 2.3.0
*/
if (!defined('ABSPATH')) {
exit;
}
// Exit if accessed directly
// Load colours
$bg = get_option('woocommerce_email_background_color');
$body = get_option('woocommerce_email_body_background_color');
$base = get_option('woocommerce_email_base_color');
$base_text = wc_light_or_dark($base, '#202020', '#ffffff');
$text = get_option('woocommerce_email_text_color');
$bg_darker_10 = wc_hex_darker($bg, 10);
$body_darker_10 = wc_hex_darker($body, 10);
$base_lighter_20 = wc_hex_lighter($base, 20);
$base_lighter_40 = wc_hex_lighter($base, 40);
$text_lighter_20 = wc_hex_lighter($text, 20);
// !important; is a gmail hack to prevent styles being stripped if it doesn't like something.
?>
#wrapper {
background-color: <?php
echo esc_attr($bg);
?>
;
margin: 0;
padding: 70px 0 70px 0;
示例3: woocommerce_compile_less_styles
/**
* Generate CSS from the less file when changing colours.
*
* @access public
* @return void
*/
function woocommerce_compile_less_styles()
{
global $woocommerce;
$colors = array_map('esc_attr', (array) get_option('woocommerce_frontend_css_colors'));
$base_file = WC()->plugin_path() . '/assets/css/woocommerce-base.less';
$less_file = WC()->plugin_path() . '/assets/css/woocommerce.less';
$css_file = WC()->plugin_path() . '/assets/css/woocommerce.css';
// Write less file
if (is_writable($base_file) && is_writable($css_file)) {
// Colours changed - recompile less
if (!class_exists('lessc')) {
include_once WC()->plugin_path() . '/includes/libraries/class-lessc.php';
}
if (!class_exists('cssmin')) {
include_once WC()->plugin_path() . '/includes/libraries/class-cssmin.php';
}
try {
// Set default if colours not set
if (!$colors['primary']) {
$colors['primary'] = '#ad74a2';
}
if (!$colors['secondary']) {
$colors['secondary'] = '#f7f6f7';
}
if (!$colors['highlight']) {
$colors['highlight'] = '#85ad74';
}
if (!$colors['content_bg']) {
$colors['content_bg'] = '#ffffff';
}
if (!$colors['subtext']) {
$colors['subtext'] = '#777777';
}
// Write new color to base file
$color_rules = "\n@primary: " . $colors['primary'] . ";\n@primarytext: " . wc_light_or_dark($colors['primary'], 'desaturate(darken(@primary,50%),18%)', 'desaturate(lighten(@primary,50%),18%)') . ";\n\n@secondary: " . $colors['secondary'] . ";\n@secondarytext: " . wc_light_or_dark($colors['secondary'], 'desaturate(darken(@secondary,60%),18%)', 'desaturate(lighten(@secondary,60%),18%)') . ";\n\n@highlight: " . $colors['highlight'] . ";\n@highlightext: " . wc_light_or_dark($colors['highlight'], 'desaturate(darken(@highlight,60%),18%)', 'desaturate(lighten(@highlight,60%),18%)') . ";\n\n@contentbg: " . $colors['content_bg'] . ";\n\n@subtext: " . $colors['subtext'] . ";\n ";
file_put_contents($base_file, $color_rules);
$less = new lessc($less_file);
$compiled_css = $less->parse();
$compiled_css = CssMin::minify($compiled_css);
if ($compiled_css) {
file_put_contents($css_file, $compiled_css);
}
} catch (exception $ex) {
wp_die(__('Could not compile woocommerce.less:', 'woocommerce') . ' ' . $ex->getMessage());
}
}
}
示例4: test_wc_light_or_dark
/**
* Test wc_light_or_dark().
*
* @since 2.2
*/
public function test_wc_light_or_dark()
{
$this->assertEquals('#FFFFFF', wc_light_or_dark('005dab'));
$this->assertEquals('#FFFFFF', wc_light_or_dark('#005dab'));
}
示例5: get_option
//red";
$order_items_table_outer_border_radius = $order_items_table_outer_border_style != 'none' ? get_option("ec_deluxe_all_order_item_table_radius") : '0';
//3px
$order_items_table_inner_border_width = 1;
//px
$order_items_table_inner_border_style = get_option("ec_deluxe_all_border_style");
//"dotted";
$order_items_table_inner_border_color = get_option("ec_deluxe_all_border_color");
//"#d4d4d4";
$order_items_table_header_bg_color = "none";
$order_items_table_td_padding = 9;
//px
//Footer Styling
$footer_bg_color = $top_nav_bg_color;
// get_option( "ec_deluxe_all_footer_color" ); // "#F9F9F5";
$footer_text_color = wc_light_or_dark($footer_bg_color, wc_hex_darker($footer_bg_color, 60), wc_hex_lighter($footer_bg_color, 60));
$footer_border_bottom_color = wc_hex_darker($footer_bg_color, 5);
$footer_a_color = "#3C3C3C";
$footer_a_decoration = "none";
$footer_a_style = "none";
/* Style
---------------------------------------- */
ob_start();
?>
<style>
/* Main Styles
---------------------------------------- */
body { margin: 0; padding: 0; font-family: Arial, sans-serif; line-height: <?php
echo $body_line_height;
?>
示例6: get_option
/**
* Email Styles
*
* @author WooThemes
* @package WooCommerce/Templates/Emails
* @version 2.3.0
*/
if (!defined('ABSPATH')) {
exit;
}
// Exit if accessed directly
// Load colours
$bg = get_option('woocommerce_email_background_color');
$body = get_option('woocommerce_email_body_background_color');
$base = get_option('woocommerce_email_base_color');
$base_text = wc_light_or_dark($base, '#FFFFFF', '#ffffff');
$text = get_option('woocommerce_email_text_color');
$bg_darker_10 = wc_hex_darker($bg, 10);
$body_darker_10 = wc_hex_darker($body, 10);
$base_lighter_20 = wc_hex_lighter($base, 20);
$base_lighter_40 = wc_hex_lighter($base, 40);
$text_lighter_20 = wc_hex_lighter($text, 20);
// !important; is a gmail hack to prevent styles being stripped if it doesn't like something.
?>
#wrapper {
background-color: <?php
echo esc_attr($bg);
?>
;
margin: 0;
padding: 70px 0 70px 0;
示例7: wc_light_or_dark
?>
;
$secondary: <?php
echo $colors['secondary'];
?>
;
$secondarytext: <?php
echo wc_light_or_dark($colors['secondary'], 'desaturate(darken($secondary,60%),18%)', 'desaturate(lighten($secondary,60%),18%)');
?>
;
$highlight: <?php
echo $colors['highlight'];
?>
;
$highlightext: <?php
echo wc_light_or_dark($colors['highlight'], 'desaturate(darken($highlight,60%),18%)', 'desaturate(lighten($highlight,60%),18%)');
?>
;
$contentbg: <?php
echo $colors['content_bg'];
?>
;
$subtext: <?php
echo $colors['subtext'];
?>
;
p.demo_store {
background-color: $primary;
color: $primarytext;
}