Instead of reading the color names, NVDA announces the RGB values of the colors in the fill tab page of format cells dialog in Excel. #3045

nvaccessAuto opened this Issue Mar 4, 2013 · 18 comments

1 participant


Reported by sumandogra on 2013-03-04 11:49
Excel 2010
The color names are not announces in the color column of the fill tab page of the format cells dialog. NVDA announces the RGB values instead.
Steps to reproduce:
1. Press CTRL+1 to open format cells dialog.
2. CTRL+TAB to the fill tab page.
3. TAB to background color control.
4. Use DOWN ARROW to get the color list.
5. Move in the list of available colors with ARROWS
6. NVDA reads the RGB values of the colors instead of announcing the color names.


Comment 1 by dineshkaushal on 2014-11-20 11:22
One way to fix this issue is to use webcolors library. Is this library already part of NVDA? I could not find it so can we include that?


Comment 2 by jteh on 2014-11-20 21:01
NVDA already has its own colors module which can calculate color names. See colors.RGB.


Comment 3 by siddhartha_iitd on 2015-02-15 08:40
I read the section on NVDAObjects in Developer's guide and found that most of the information regarding creating or customizing NVDAObjects is in context to plugins - appModules and globalPlugins. There is no plugin for MS Excel. So, do I need to create one before creating an NVDAObject for color ?

Initially, I tried this: I wrote a class Color in IAccessible, similar to the Button/Taskbar and overrode it's name and description properties according to our need. Then, I created a mapping for this class in _staticMap. I figured out the role value to be 15. However, this method didn't work.


Comment 4 by jteh on 2015-02-15 22:59
You do not need to create a plug-in. If this control is only used in Excel and nowhere else, you should probably do it in an app module. If it appears in multiple office applications, do it as you've tried already.

Which role value did you use? For IAccessible._staticMap, you want IAccessibleRole, not just role.


Comment 5 by siddhartha_iitd on 2015-02-17 07:52
Following is the code change made in It's speaking the color names from colors.RGB. As regards IAccessibleRole, I looked in NVDA dev-info but only ROLE_TABLECELL was there.

class Color(IAccessible):
    def _get_name(self):
        name = super(Color,self).name
        patternRGB = r'RGB\(\d+, \d+, \d+\)'
        if re.match(patternRGB, name):
            return colors.RGB.fromString(name).name
             return name

_staticMap = { ##Other mappings there

Please suggest if any modifications are required. Thanks!


Comment 6 by jteh on 2015-02-20 07:29
If it's IAccessible, you're looking for "IAccessible accRole" in the dev info.

It's also slightly possible it's UIA. In that case, you'll see UIA info in dev info. You'll need to handle this elsewhere if that's the case.


Comment 7 by siddhartha_iitd on 2015-02-20 13:07
Thanks! I used self.IAccessibleRole to get the value of IAccessibleRole and found its value to be 34 or ROLE_SYSTEM_LISTITEM. Thus, I used the same in the mapping. Mapping now looks like:


Comment 8 by jteh on 2015-02-20 21:16
In general, the approach is fine. However:

  • The class should go in the NVDAObjects.IAccessible.msOffice module, as I noted on the call.
  • You should probably define the compiled regular expression (re.compile) as a class constant to avoid unnecessary compilation each time this code runs.
  • As Mick noted on the call, if many of the colours have the same name, it may be necessary to include the rgb values (in a friendly form) in the description.

Please provide a branch for your code. Thanks.


Comment 9 by siddhartha_iitd (in reply to comment 8) on 2015-02-23 09:42

  • The class should go in the NVDAObjects.IAccessible.msOffice module, as I noted on the call.

Moved the class Color to NVDAObjects.IAccessible.msOffice module

  • As Mick noted on the call, if many of the colours have thea same name, it may be necessary to include the rgb values (in a friendly form) in the description.

A little clarification needed here: If the colors have different RGB values, is it not possible to say different color names or something like color x with lesser r/g/b ?
RGB value is obtained from IAccessible(Color).name. Do you want me to provide this information in _get_description ?


Comment 10 by mdcurran on 2015-03-16 06:07
I think in _get_description would be best. Then people can turn off descriptions if they like.


Comment 11 by siddhartha_iitd on 2015-03-16 08:01
Source Code is available in branch in_t3045 at following url:


Comment 12 by mdcurran on 2015-03-18 02:26
GetRGBNameAndMatch should be a property rather than a method, so that NVDA caches the result. Rename it to _get_rgbNameAndMatch
But call it as self.rgbNameAndMatch

I don't think this code would conflict with anything else. But it is more the question of what that class should be called. I think I'd rather see it called something like CommandBarListItem rather than Color, as This class will probably get used a lot on other list items on MSOCommandBars that are not showing colors.


Comment 13 by siddhartha_iitd on 2015-03-20 07:26
Thanks Mike. I've updated the code as suggested above. The color names that are being spoken are quite different from the color which this MSOCommandbar item represent. For example, for some variants of blue/red/green, it says Gray.
The updated code is available in branch in_t3045 at following url:


Comment 14 by Michael Curran <mick@... on 2015-03-31 00:06
In [c409fd1]:
```CommitTicketReference repository="" revision="c409fd11564ce9d1258d7c04c70d6fe8ce319bbd"
Merge branch 't3045' into next. Incubates #3045

Added labels: incubating

Comment 15 by mdcurran on 2015-03-31 00:11
Code was taken into NV Access branch t3045. However, a few small changes were made:

  • One or two lines with whitespace changes were removed. Please check your diffs!
  • The description was made translatable. We only accept strings that are translatable.

I also merged t4984 (#4984) into this branch as it greatly improves color name detection, now picking from about 140 colors, rather than 16. That grey issue should now be gone.


Comment 16 by siddhartha_iitd on 2015-03-31 04:31
Thank You! I'm sorry for the whitespace issues. I'll make sure to check the diffs from now on. I'd like to see the changes regarding translatable strings, mentioned in the second point. I'll git pull the branch.


Comment 17 by James Teh <jamie@... on 2015-04-14 06:40
In [effb336]:
```CommitTicketReference repository="" revision="effb336372b94d1247c15a28d204a6068a19f20c"
When selecting colors in Microsoft Office applications, color names are now reported.

Fixes #3045.

Removed labels: incubating
State: closed

Comment 18 by jteh on 2015-04-14 06:41
Milestone changed from None to 2015.2

@nvaccessAuto nvaccessAuto added the bug label Nov 10, 2015
@nvaccessAuto nvaccessAuto added this to the 2015.2 milestone Nov 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment