Site icon Hip-Hop Website Design and Development

How to use term meta values for each post on home page

I can do this for single posts but not on the home page archive.

When i add a meta value on the term archive edit screen, i want to use it in the home.php file to target posts in specific categories.

But, this uses the value from the 1st post category to style all posts in the home page loop. I need to style each differently based on the term meta value added via the archive edit page.

add_action( 'wp_enqueue_scripts', 'inline_css' );
function inline_css() {

$terms = get_the_terms( get_queried_object_id(), 'category' );

$term = array_pop( $terms );

$color = get_term_meta( get_queried_object_id(), 'color', true);

$css = sprintf( '

.post {
    color: %s;
}

', $color );


if ( $css ) {

wp_add_inline_style( child-theme, $css );
    }

}

Anyway to modify this so home page posts are styles based on the color value added via the edit term page