Created
September 20, 2018 21:23
-
-
Save bahia0019/9a7ee348504c8288105ed9ecfb0f259e to your computer and use it in GitHub Desktop.
Convert Hex string to RGBA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Take Accent color, and convert it to RGBA, and add an opacity of .75. | |
*/ | |
$accent = get_theme_mod( 'site_accent_color' ); | |
$accent_string = ltrim( $accent, '#' ); | |
$arr = str_split( $accent_string, '2' ); | |
foreach ( $arr as $value ) { | |
$new_value = hexdec( $value ) . ', '; | |
$rgb .= $new_value; | |
} | |
$accent_opacity = 'rgba(' . $rgb . '.75)'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment