Changing Post Tag Color Based On Post Count

Here you go. I just added a class using $tag->count. Tested and works.

<div class="container">
    <?php $tags = get_tags(array(
       'hide_empty' => false,
       'count' => true
    ));

    foreach ($tags as $tag) :?>
        <a class="count-<?php echo $tag->count; ?>" href="https://wordpress.stackexchange.com/questions/324587/<?php echo esc_url( get_tag_link( $tag->term_id ) ); ?>" title="<?php echo esc_attr( $tag->name ); ?>"><?php echo esc_html( $tag->name ); ?></a>
    <?php endforeach; ?>
</div><!-- END CONTAINER -->

This will add the class count-0 if there are no posts. so just add something similar to this CSS.

.count-0 {
    color: grey;
}