wc_hex_darker()
Make HEX color darker.
Хуков нет.
Возвращает
Строку
.
Использование
wc_hex_darker( $color, $factor );
- $color(разное) (обязательный)
- Color.
- $factor(int)
- Darker factor.
По умолчанию: 30
Код wc_hex_darker() wc hex darker WC 9.3.3
function wc_hex_darker( $color, $factor = 30 ) { $base = wc_rgb_from_hex( $color ); $color = '#'; foreach ( $base as $k => $v ) { $amount = $v / 100; $amount = NumberUtil::round( $amount * $factor ); $new_decimal = $v - $amount; $new_hex_component = dechex( $new_decimal ); if ( strlen( $new_hex_component ) < 2 ) { $new_hex_component = '0' . $new_hex_component; } $color .= $new_hex_component; } return $color; }