in SAM2-Demo/Common/Color+Extension.swift [31:40]
func colorDistance(_ color1: Color, _ color2: Color) -> Double {
let rgb1 = color1.rgba;
let rgb2 = color2.rgba;
let rDiff = rgb1.red - rgb2.red
let gDiff = rgb1.green - rgb2.green
let bDiff = rgb1.blue - rgb2.blue
return sqrt(rDiff*rDiff + gDiff*gDiff + bDiff*bDiff)
}