تابع ووکامرسی wc_rgb_from_hex تبدیل رنگ از hex به RGB

تابع ووکامرسی wc_rgb_from_hex – تبدیل رنگ از hex به RGB
Syntax – سینتکس
(string) wc_rgb_from_hex( (mixed) $color );
Parameters – پارامتر ها (1)
- 1- $color (mixed)
Usage – نحوه استفاده
if ( !function_exists( 'wc_rgb_from_hex' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-formatting-functions.php';
}
// The color.
$color = null;
// NOTICE! Understand what this does before running.
$result = wc_rgb_from_hex($color);
Defined – محل تعریف
/includes/wc-formatting-functions.php
function wc_rgb_from_hex( $color ) {
$color = str_replace( '#', '', $color );
// Convert shorthand colors to full format, e.g. "FFF" -> "FFFFFF"
$color = preg_replace( '~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color );
$rgb = array();
$rgb['R'] = hexdec( $color{0} . $color{1} );
$rgb['G'] = hexdec( $color{2} . $color{3} );
$rgb['B'] = hexdec( $color{4} . $color{5} );
return $rgb;
}
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر