I am trying to use the Theme Customization API but I keep getting an error

I’m still relatively new to WordPress Development, but shouldn’t this code be in customizer.php, in the “inc” folder(which would be within your active theme’s folder)?

Also I know the codex says this particular code is just for the live preview, but after adding it in one of my projects it seemed to fix my issue. So you may need to include these get commands for each section you add in the customizer_register function. For instance, before the first bit of your code, try including:

function lmao_customize_register( $wp_customize ) {
    $wp_customize->get_setting( 'lmao_colors' )->transport="postMessage";
}
add_action( 'customize_register', 'testing_customize_register' );

Then you would begin with adding the section

function lmao_customizer_register($wp_customize) {
    $wp_customize->add_section('lmao_colors',  array(
        'title' => __('colors', 'lmao'),
        'description' => 'modify the theme colors'
));

    $wp_customize->add_setting('background_color',  array(
        'default' => '#fff',
        'type' => 'option' 
));

    $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'background_color',  array(

        'label' => __('Edit Background Color', 'lmao'),
        'section' => 'lmao_colors',
        'settings' => 'background_color'

) ));
}

I hope that is helpful. I’m sorry if not, like I said I’m still new myself, but I wanted to try to make an answer, since it seems you’ve had this question posted for a while now without response.

Best of luck!