The colors are assigned in the order they are listed in the palette, starting with the first color, going down the list and then looping back to the first color once the last color is reached in the palette.
Assigning colors using this logic means that when you look at graphs side by side, the colors can be different for the same legend names across the graphs.
Selecting the Use Consistent Graph Colors option at the system level sets the default for all graphs to use the consistent color option, but you can change this default setting at the graph portlet level. If you make changes at the individual graph portlet level, users can:
To select consistent graph colors:
Also check OOTB Color Palette for Graphs for the exact colors