I assume you’re wanting an image tag in there too:
if ( $colors && in_array( 'green', $colors ) ) {
echo '<div class="asdsf"><img src="';
echo bloginfo('template_directory') . '/path/within/theme/to/img.png';
echo '"></div>';
}
But it’s better to use the newer get_stylesheet_directory_uri()
which will work whether or not you are using a child theme.
if ( $colors && in_array( 'green', $colors ) ) {
echo '<div class="asdsf"><img src="';
echo get_stylesheet_directory_uri() . '/path/within/theme/to/img.png';
echo '"></div>';
}