public BeamColor GetBeamColor() { Log($"Battle.Raid.GetBeamColor()"); int red = 0; int purple = 0; var colors = VideoCapture.GetPixels(915, 540, 90, 1).Select(u => new HSVColor(u)); foreach (var color in colors) { //Log(color.H, " ", color.S, " ", color.V); if ((color.H >= 330 || color.H <= 10) && color.S >= 25) { red++; } if ((color.H >= 280 && color.H <= 310) && color.S >= 25) { purple++; } } Log(red, " ", purple); if (red > 5 && red >= purple * 2) { return(BeamColor.Red); } if (purple > 5 && purple >= red * 2) { return(BeamColor.Purple); } return(BeamColor.Unknown); }