Code Duplication    Length = 18-19 lines in 2 locations

includes/wpinv-helper-functions.php 2 locations

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