OSDN Git Service

Added a 'colors' module, which contains an 'RGB' type for storing RGB color values...
authorMichael Curran <mick@kulgan.net>
Wed, 15 Sep 2010 06:03:07 +0000 (16:03 +1000)
committerMichael Curran <mick@kulgan.net>
Wed, 15 Sep 2010 06:03:07 +0000 (16:03 +1000)
commit68eb1cdbe416b621095b1a780836fcd79c122be2
tree9e64922eb43790cd16a39ee3d4aa728b70b80d9a
parent4400abd52badd478ef2f1dbe780698e84e122747
Added a 'colors' module, which contains an 'RGB' type for storing RGB color values, and a 'findColorName' function which finds the closest color name for a given RGB value. NVDA does not yet make use of this module.
The known color names are stored in a 'RGBToNames' dictionary, and the color names are translatable.
So far the standard 16 HTML colors have been added to the dictionary.
      FindColorName first looks for an exact match, but if not successful it locates the closest color buy sorting the known colors by their distance from the given color, in the 3 dimensional color space. It also takes the standard human eye color biasing in to account (e.g. humans think that green is brighter than blue). It also caches the color with the found name in the dictionary for quickeraccess next time.
source/colors.py [new file with mode: 0644]