wc_format_hex() WC 1.0
Format string as hex.
Хуков нет.
Возвращает
Строку/null.
Использование
wc_format_hex( $hex );
- $hex(строка) (обязательный)
- HEX color.
Код wc_format_hex() wc format hex WC 5.0.0
function wc_format_hex( $hex ) {
$hex = trim( str_replace( '#', '', $hex ) );
if ( strlen( $hex ) === 3 ) {
$hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
}
return $hex ? '#' . $hex : null;
}