Freigeben über


Access and Colors: How Access 2003 works

There is a lot of confusion regarding the Access color properties, such as font color, control background, etc. People just don't grok the numeric values that Access uses. And that's not surprising considering how misleading it is.

Perhaps one reason for that is that nowadays everybody uses HTML colors, which are actually very simple: 24 bit values with 8 bits per color component from the least significant to the more significant: blue, green, red. So values look like #RRGGBB. For example, red is #FF0000.

However, in Access the color properties are actually encoded as BGR (blue, red, green) values, from 0x000000 through 0xFFFFFF. Altough this might seem totally weird, there is good reason for it, and it comes through clearly as one notices that VBA's color functions work the same way. For example, the RGB function in VBA will generate BGR values. So, RGB(255, 0, 0) will return 255 instead of 16711680 (0xFF0000) as one would think. For example, a pure green in Access is 65280 = #00FF00 = &H00FF00 = RGB(0, 255, 0).

[VBA Homework: how would you convert between RGB and BGR?]

Finally, there is one additional bonus in the Access color properties: system colors. These special colors can be used through a set of negative numbers (below), and will change depending on the Windows Theme currently being used. So unless you plan accordingly, the contrast between fonts and background and other control when you are developing might not be there (it might appear as white on white) when a user has a funky theme installed. A nice bonus of using these system colors is that you will get automatic accessibility as users turn on high contrast.

  • -2147483648 : System Scrollbar
  • -2147483647 : System Desktop
  • -2147483646 : System Active Title Bar
  • -2147483645 : System Inactive Title Bar
  • -2147483644 : System Menu Background
  • -2147483643 : System Window
  • -2147483642 : System Window Frame
  • -2147483641 : System Menu Text
  • -2147483640 : System Window Text
  • -2147483639 : System Title Bar Text
  • -2147483638 : System Active Border
  • -2147483637 : System Inactive Border
  • -2147483636 : System Application Background
  • -2147483635 : System Highlight
  • -2147483634 : System Highlight Text
  • -2147483633 : System Button Face
  • -2147483632 : System Button Shadow
  • -2147483631 : System Disabled Text
  • -2147483630 : System Button Text
  • -2147483629 : System Inactive Caption Text
  • -2147483628 : System 3D Highlight
  • -2147483627 : System 3D Shadow
  • -2147483626 : System 3D Light
  • -2147483625 : System ToolTip Text
  • -2147483624 : System ToolTip Background
  • -2147483623 : System Static
  • -2147483622 : System Static Text
  • -2147483621 : System Gradient Active Caption
  • -2147483620 : System Gradient Inactive Caption
  • -2147483619 : System Menu Highlight
  • -2147483618 : System Menu Bar

Next week I'll talk about how we're improving color properties with Access 2007. Stay tuned!

Comments

  • Anonymous
    April 04, 2006


    "I find color schemes that I just like and that just feel right" - Alan Bean
    Last week  I spoke...
  • Anonymous
    May 04, 2006
    The comment has been removed
  • Anonymous
    May 04, 2006
    There is an autoformat called "Access 2003" that uses system colors to the same extent that the Access 2003 autoformat does. (Basically, in Access 2007 we're adding a lot of new autoformats, but we still keep an option ["Access 2003"] that matches exactly what Access 2003 currently does).

    Keep in mind, however, that since now Office themes itself different from the OS, apps that use these colors might look a little weird (e.g. Windows XP Green colors with an application frame of blue).
  • Anonymous
    May 04, 2006
    <to the same extent that the Access 2003 autoformat does>

    I did not realize that 2003 used system colors at all in the autoformats. It has been so long I have been using my own that I have not looked at the ones in 2003.

    As for Office using non system themes ... I think this is a bad idea but no one asked me :-)

    Steve
  • Anonymous
    June 13, 2009
    PingBack from http://barstoolsite.info/story.php?id=6732