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