str_replace inside specific css files [closed]

No, because the CSS file isn’t loaded in and parsed by PHP—it’s just “printed” to the browser at the appropriate time.

You can, however, add inline styles to an enqueued stylesheet, which you would then be able to manipulate with filters.

In the code snippet below, let’s assume you’re using wp-content/plugins/my-plugin/assets/style.css.

add_action( 'wp_enqueue_scripts', 'wpse406238_inline_css' );
function wpse406238_inline_css() {
    // Define any dependencies here.
    $dependencies = array();
    // Set your version number here.
    $version = '1.0.0';
    // Define the media for the stylesheet here.
    $media="all";
    wp_enqueue_style( 'my-handle', plugins_url( '/assets/style.css', __FILE__ ), $dependencies, $version, $media );

    // Add some inline CSS.
    $inline_css="h1 { color: #000; }";
    // Filter that inline CSS, so others can change it as needed.
    $inline_css = apply_filters( 'my_plugin_inline_css', $inline_css );
    // Add the CSS to the rendered page.
    wp_add_inline_style( 'my-handle', $inline_css ); 

}

// ...elsewhere...
add_filter( 'my_plugin_inline_css', 'wpse_406238_filter_my_css' );
function wpse_406238_filter_my_css( $css ) {
    // Green is the new black.
    $css = str_replace( '#000', '#0f0', $css );
    return $css;
}

References