android - Convert color integer to text? -
i need convert color integer value text? example, @ imaginative code
int mycolor = -16777216; //int value color.black convertcolortotext(mycolor); the method return string value "black".
is possible , how it?
update
my app uses color picker (code.google.com/p/android-color-picker) , want notify user color has chosen. example, chooses black color, clicks ok button, , sees toast saying "you have chosen black color".
i don't think can out-of-the-box, best can build map or list of known colors (for example using 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta', 'yellow', 'lightgray', 'darkgray' -> standard android colors understood parsecolor method http://developer.android.com/reference/android/graphics/color.html#parsecolor(java.lang.string)
and find lookup , either exact match (but usefulness of limited) or finding closest color. can find out , simplest algorithm of finding best match here, example: best algorithm matching colours.
Comments
Post a Comment