|
@@ 719-736 (lines=18) @@
|
| 716 |
|
return $rgb; |
| 717 |
|
} |
| 718 |
|
|
| 719 |
|
function wpinv_hex_darker( $color, $factor = 30 ) { |
| 720 |
|
$base = wpinv_rgb_from_hex( $color ); |
| 721 |
|
$color = '#'; |
| 722 |
|
|
| 723 |
|
foreach ( $base as $k => $v ) { |
| 724 |
|
$amount = $v / 100; |
| 725 |
|
$amount = round( $amount * $factor ); |
| 726 |
|
$new_decimal = $v - $amount; |
| 727 |
|
|
| 728 |
|
$new_hex_component = dechex( $new_decimal ); |
| 729 |
|
if ( strlen( $new_hex_component ) < 2 ) { |
| 730 |
|
$new_hex_component = "0" . $new_hex_component; |
| 731 |
|
} |
| 732 |
|
$color .= $new_hex_component; |
| 733 |
|
} |
| 734 |
|
|
| 735 |
|
return $color; |
| 736 |
|
} |
| 737 |
|
|
| 738 |
|
function wpinv_hex_lighter( $color, $factor = 30 ) { |
| 739 |
|
$base = wpinv_rgb_from_hex( $color ); |
|
@@ 738-756 (lines=19) @@
|
| 735 |
|
return $color; |
| 736 |
|
} |
| 737 |
|
|
| 738 |
|
function wpinv_hex_lighter( $color, $factor = 30 ) { |
| 739 |
|
$base = wpinv_rgb_from_hex( $color ); |
| 740 |
|
$color = '#'; |
| 741 |
|
|
| 742 |
|
foreach ( $base as $k => $v ) { |
| 743 |
|
$amount = 255 - $v; |
| 744 |
|
$amount = $amount / 100; |
| 745 |
|
$amount = round( $amount * $factor ); |
| 746 |
|
$new_decimal = $v + $amount; |
| 747 |
|
|
| 748 |
|
$new_hex_component = dechex( $new_decimal ); |
| 749 |
|
if ( strlen( $new_hex_component ) < 2 ) { |
| 750 |
|
$new_hex_component = "0" . $new_hex_component; |
| 751 |
|
} |
| 752 |
|
$color .= $new_hex_component; |
| 753 |
|
} |
| 754 |
|
|
| 755 |
|
return $color; |
| 756 |
|
} |
| 757 |
|
|
| 758 |
|
function wpinv_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) { |
| 759 |
|
$hex = str_replace( '#', '', $color ); |