Here are two ways to do it: https://thehoneycombhome.com/diy-granite-countertops-yes-really/ and https://thehoneycombhome.com/how-to-paint-kitchen-countertops/
Mine didn't last even though I had 3 coats of poly on it.
Take photos of the countertops to the home improvement store and ask for their advice on materials and application methods.
Twice I have done this and it worked. I used KILZ for a first coat and then acrylic paint for the second with the color. Then I polyurethaned with 3 coats, being careful not to stir or shake the can so you don't have bubbles. Paint on with smooth stroke. This beats replacing with granite - maybe $25?