plugin development – How to display user’s avatar on the top of main menu in WordPress admin panel?

I got a requirement to update the WordPress’s admin panel, where I need to display the current user’s avatar on the top of admin’s main menu(see the screenshot).

add_action( 'admin_menu', 'register_my_custom_menu_page' );                   
    function register_my_custom_menu_page() 
       add_menu_page( 'Custom Menu Page Title', 'Custom Menu Page', 'manage_options', 'logo_based_menu', '', '', 1);                                                           

function admin_style() {
global $current_user;
$current_user = wp_get_current_user();
$user_avatar = get_avatar( $current_user->ID, '', '','',array('class' => 'rounded-circle mb-2'));
echo '<style>
    #toplevel_page_logo_based_menu {
background-image: url("'.$user_avatar.'"); // not working
background-repeat: no-repeat; 
    #toplevel_page_logo_based_menu > a, #toplevel_page_logo_based_menu > a > div.wp-menu-image {
display: none;}
 add_action('admin_enqueue_scripts', 'admin_style');

enter image description here