PluginProbe
Borderless – Addons and Templates for Elementor / trunk
Borderless – Addons and Templates for Elementor vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 All 78 releases
borderless / includes / helper.php

helper.php in Borderless – Addons and Templates for Elementor trunk, at includes/helper.php

41 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // don't load directly
4 defined( 'ABSPATH' ) || exit;
5
6
7 // Color Pallete - Light Colors
8 function luminanceLight($hexcolor, $percent)
9 {
10 if ( strlen( $hexcolor ) < 6 ) {
11 $hexcolor = $hexcolor[0] . $hexcolor[0] . $hexcolor[1] . $hexcolor[1] . $hexcolor[2] . $hexcolor[2];
12 }
13 $hexcolor = array_map('hexdec', str_split( str_pad( str_replace('#', '', $hexcolor), 6, '0' ), 2 ) );
14
15 foreach ($hexcolor as $i => $color) {
16 $from = $percent < 0 ? 0 : $color;
17 $to = $percent < 0 ? $color : 255;
18 $pvalue = ceil( ($to - $from) * $percent );
19 $hexcolor[$i] = str_pad( dechex($color + $pvalue), 2, '0', STR_PAD_LEFT);
20 }
21
22 return '#' . implode($hexcolor);
23 }
24
25 // Color Pallete - Dark Colors
26 function luminanceDark($hexcolor, $percent)
27 {
28 if ( strlen( $hexcolor ) < 6 ) {
29 $hexcolor = $hexcolor[0] . $hexcolor[0] . $hexcolor[1] . $hexcolor[1] . $hexcolor[2] . $hexcolor[2];
30 }
31 $hexcolor = array_map('hexdec', str_split( str_pad( str_replace('#', '', $hexcolor), 6, '0' ), 2 ) );
32
33 foreach ($hexcolor as $i => $color) {
34 $from = $percent < 0 ? 0 : $color;
35 $to = $percent < 0 ? $color : 0;
36 $pvalue = ceil( ($to - $from) * $percent );
37 $hexcolor[$i] = str_pad( dechex($color + $pvalue), 2, '0', STR_PAD_LEFT);
38 }
39
40 return '#' . implode($hexcolor);
41 }