|Excel does not have a built in function to Sum by colors.|
There are a number of VBA User Defined Functions available via a Google search that might work for you.
Keep in mind that cells can be colored via the basic Fill Color feature or by Conditional Formatting. It's fairly easy for VBA to find/count/sum cells that have been colored by the Fill method, but a bit more difficult to do the same for Conditionally Formatted cells.
When you do your search, make sure you are matching the solution to your needs.
Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.