My display is a window produced by Java.
Would have been interesting to have more details.
in any case, if you are stuck with this communication channel, then it seems you do need to send a string over the serial line for the color and can't send numbers - so you need to map the RGB values you read from the sensor to the "closest" color name.
The color names have conventional (R,G,B) definitions, could be something like this
black (0,0,0)
white (255,255,255)
cyan (0,255,255)
darkgray (169,169,169)
gray (128,128,128)
green (0,255,0)
lightgray (211,211,211)
magenta (255,0,255)
orange (255,165,0)
pink (255,192,203)
red (255,0,0)
blue (0,0,255)
yellow (255,255,0)
darkgreen (0,100,0)
So now you know what RGB values are associated with the names and you need to calculate the distance between (R1, G1, B1) which is what you got from your sensor and (R2, G2, B2) which will take all the possible values in the table and find the minimum distance. The (R2, G2, B2) which gave you that minimum distance will be the name to use.
Measuring a distance between two RGB colors is not as trivial as it may sound. There are many possibilities, you can read about it in wikipedia for example.
I'd suggest you pick a formula in there. Either the weighted approach (red 30%, green 59%, and blue 11%)
d = sqrt(((R[sub]2[/sub]-R[sub]1[/sub])*0.3)^2 + ((G[sub]2[/sub]-G[sub]1[/sub])*0.59)^2 + ((B[sub]2[/sub]-B[sub]1[/sub])*0.11)^2)
but the better one is probably the more complex one
and since you're not really interested in the actual d value, you can skip the square root
create an 2D array with the RGB values in the same order as their color name array
String colors[] = {
"black", "white", "cyan", "darkgray", "gray", "green", "lightgray", "magenta", "orange",
"pink", "red", "blue", "yellow", "darkgreen"
};
write a distance function that takes two (RGB) triplets and return the distance as described above
write a for loop going through the array and find the index of the shortest distance
use this index to decide what string to send.