by mkronenfeld on WordPress.org
You can find your image swatches in the post meta. There are two global php functions to get these values:
wpip_get_post_thumbnail_color( int|WP_Post $post )
Gets the main rgb color from a post.
wpip_get_post_thumbnail_colors( int|WP_Post $post )
Gets the main rgb colors from a post.
Advanced users may also like the following functions to extract the colors from any image they want in WordPress.
wpip_get_image_color( string $file, int $precision = 20, int $palette_length = 5 )
Gets the main color from an image.
wpip_get_image_colors( string $file, int $precision = 20, int $palette_length = 5 )
Gets the image color palette.