How to add php stylesheet to admin section instead of admin_head hook

If you enqueue your style sheet first you should be able to use wp_add_inline_style afterwards.

function custom_style() {
    wp_enqueue_style('your_css', plugin_dir_url( __FILE__ ) . 'style/your_css.css' );
    $bg_color = get_option('custom_color');
    $custom_css = " body { background-color: {$bg_color}; }";
    wp_add_inline_style( 'your_css', $custom_css );
}

This is not tested (just written from mind) and I have never used it in the admin section. Just test it with admin_enqueue_scripts.

error code: 523