Is there a Blender api to fill a color to a certain vertex_colors?
Set all loop vertex colors to one
Use foreach set method. Example of use here creating bezier curves https://blender.stackexchange.com/a/180184/15543
import bpy
import numpy as np

context = bpy.context

name = &quot;Xxxx&quot;
r, g, b, a = (1, 0, 0, 1) # red


ob = context.object
me = ob.data

color_layer = (me.vertex_colors.get(name)
               or me.vertex_colors.new(name=name)
               )
ones = np.ones(len(color_layer.data))

color_layer.data.foreach_set(
        &quot;color&quot;,
        np.array((r * ones, g * ones, b * ones, a * ones)).T.ravel(),
        )
        
me.update()

Could also simply
np.array((r, g, b, a) * len(color_layer.data)).T.ravel()