function colorContrast,image,x,y

    ; Return a pair [c1,c2] of color values (0..255),
    ; one (c1) that is the color of the point (x,y) on the
    ; image, and another (c2) that contrasts with it.

    tvlct,red,grn,blu,/get  ; Get current colors
    gray = 1    ; Flag for grayscale image
    g = where(red ne grn or red ne blu or grn ne blu,cnt)
    if cnt ne 0 then gray = 0

    sz = size(image)
    image_true = bytarr(sz[1],sz[2],3)
    image_true[*,*,0] = [red[image]]
    image_true[*,*,1] = [grn[image]]
    image_true[*,*,2] = [blu[image]]

    ; Get r,g,b values of the point
    r = red[image[x,y]]
    g = grn[image[x,y]]
    b = blu[image[x,y]]
    ind = where((red eq r) and (grn eq g) and (blu eq b),cnt)
    c1 = min(ind)

	; Get array (256) of 3rd sides of triangles defined by color 1 (r1,g1,b1)
	; and all 256 colors in the color table. These colors are represented
	; by vectors drawn from a corner of a cube (origin) to some points in
	; the cube.  They form two sides of a triangle.  We obtain the contrasting
	; color by finding the vector that gives the longest third side.

	side = fltarr(256)
	ri = 0.0
	gi = 0.0
	bi = 0.0
	r = float(r) & g = float(g) & b = float(b)
	; Get lengths of sideA and sideB
	sideA = sqrt(r^2 + g^2 + b^2)
	sideB = sqrt(ri^2 + gi^2 + bi^2)

	for i = 0,255 do begin
		; Get r,g,b color indices of i'th color
		ri = float(red[i])
		gi = float(grn[i])
		bi = float(blu[i])
		; Get third side of triangle
		side[i] = sqrt((r-ri)^2 + (g-gi)^2 + (b-bi)^2)
	endfor
	sideC = max(side)
	c2 = where(side eq sideC,cnt)	; Get color table index
	c2 = c2[0]
;help,c1,c2

	return,[c1,c2]


end