Example #1
0
File: dynamic.php Project: 6226/wp
if (!empty($sections)) {
    foreach ($sections as $name => $section) {
        //checks if we have a dark or light background and then creates a stronger version of the main font color for headings
        $section['heading'] = kleo_calc_similar_color($section['text'], kleo_calc_perceived_brightness($section['bg'], 100) ? 'lighter' : 'darker', 3);
        //check if we have a dark or lighht background and then creates a lighter version of the main font color
        $section['lighter'] = kleo_calc_similar_color($section['bg'], kleo_calc_perceived_brightness($section['bg'], 100) ? 'lighter' : 'darker', 4);
        // Highlight background color in RBG
        $section["high_bg_rgb"] = kleo_hex_to_rgb($section['high_bg']);
        // Alternate background color in RBG
        $section["alternate_bg_rgb"] = kleo_hex_to_rgb($section['alt_bg']);
        // Text color in RBG
        $section["text_color_rgb"] = kleo_hex_to_rgb($section['text']);
        // Background color in RBG
        $section["bg_color_rgb"] = kleo_hex_to_rgb($section['bg']);
        // Link color in RBG
        $section["link_color_rgb"] = kleo_hex_to_rgb($section['link']);
        /* Use like this
         * 
         * .<?php echo $name; ?>-color .rgb-element {
         *	background-color: rgba(<?php echo $section['high_bg_rgb']['r']; ?>,<?php echo $section['high_bg_rgb']['g']; ?>,<?php echo $section['high_bg_rgb']['b']; ?>,0.4);
         * }
         */
        ?>

  


/*** TEXT COLOR ***/
.popover-content, /* Leave it without $name */
.<?php 
        echo $name;
Example #2
0
-----------------------------------------------------------------*/
global $kleo_config, $kleo_theme;
$style_sets = $kleo_config['style_sets'];
$sections = kleo_style_options();
if (!empty($sections)) {
    foreach ($sections as $name => $section) {
        //checks if we have a dark or light background and then creates a stronger version of the main font color for headings
        $section['heading'] = kleo_calc_similar_color($section['text'], kleo_calc_perceived_brightness($section['bg'], 100) ? 'lighter' : 'darker', 3);
        //check if we have a dark or lighht background and then creates a lighter version of the main font color
        $section['lighter'] = kleo_calc_similar_color($section['bg'], kleo_calc_perceived_brightness($section['bg'], 100) ? 'lighter' : 'darker', 4);
        // Highlight background color in RBG
        $section["high_bg_rgb"] = kleo_hex_to_rgb($section['high_bg']);
        // Alternate background color in RBG
        $section["alternate_bg_rgb"] = kleo_hex_to_rgb($section['alt_bg']);
        // Text color in RBG
        $section["text_color_rgb"] = kleo_hex_to_rgb($section['text']);
        /* Use like this
         * 
         * .<?php echo $name; ?>-color .rgb-element {
         *	background-color: rgba(<?php echo $section['high_bg_rgb']['r']; ?>,<?php echo $section['high_bg_rgb']['g']; ?>,<?php echo $section['high_bg_rgb']['b']; ?>,0.4);
         * }
         */
        ?>

  


/*** TEXT COLOR ***/
.<?php 
        echo $name;
        ?>
Example #3
0
 /**
  *  calculates if a color is dark or light, 
  *  if a second parameter is passed it will return true or false based on the comparison of the calculated and passed value
  *  @param string $color hex color code
  *  @return array $color 
  */
 function kleo_calc_perceived_brightness($color, $compare = false)
 {
     $rgba = kleo_hex_to_rgb($color);
     $brighntess = sqrt($rgba['r'] * $rgba['r'] * 0.241 + $rgba['g'] * $rgba['g'] * 0.6909999999999999 + $rgba['b'] * $rgba['b'] * 0.068);
     if ($compare) {
         $brighntess = $brighntess < $compare ? true : false;
     }
     return $brighntess;
 }