Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Feb 2001
    Posts
    369
    Thanks
    2
    Thanked 1 Time in 1 Post

    Invert or complement colours in word vba (2000SP3)

    I am a fan of Blue Background-White text. Unfortunately, many documents become unreadable when viewed in this fashion. Some issues can be solved without worrying about reversibility (ie all black text to automatic, and white backgrounds in text boxes and tables), but colour shading and backgrounds and highlighting pose a bigger problem. Is there a reversible, mathematical operation that can be performed on a colour number to yield a complementary colour?

    I'm no colour expert, so I'm not even sure if complementary is the right word, I guess I'm looking for a transformation that will allow white text to be readable on that background. I don't quite understand what the colour numbers mean in word vba, and even if I did I'm not enough of a colour expert to be able to work it out, and am hoping someone on this forum is.

    Thanks very much

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Invert or complement colours in word vba (2000SP3)

    If you mean the values of ColorIndex: those numbers are more or less arbitrary, there's no easy way to determine a "complement". You'd have to find out what works best for you by trial and error.

    BTW, the white text on blue background feature was introduced many many versions ago to appease users of MS-DOS applications such as WordPerfect for DOS. It has been left in Word for compatibility reasons, but you shouldn't really use it any more. The MS-DOS days are far behind us.

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Wellington, New Zealand
    Posts
    143
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Invert or complement colours in word vba (2000

    If you do a Google search for "complementary color", you'll find many sites with advice about choosing complementary colors. There are also sites that offer free software to do this (see http://www.anryhome.com/software/colorpicker/ , for example).

  4. #4
    3 Star Lounger
    Join Date
    Feb 2001
    Posts
    369
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Invert or complement colours in word vba (2000

    Hans - I have to say that I find it much easier on the eye, and I'm sure I've read somewhere than ergonomists agree, so I'd be very sad to see it go. I was talking about the full colour values, not just the 1-16 of colorindex. I read that the full numbers do represent colours in RGB space, but the author didn't elaborate.

    William - thanks for your comments, but what I'm looking for is how to transform the number that represents a colour in vba into a complementary colour. Knowing what the complementary colour is helps only a little.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Invert or complement colours in word vba (2000

    The attached text file contains a function Complement together with auxiliary code that will calculate the complement of an RGB value. It uses functions from Color conversion math and formulas converted from JavaScript to VBA.

    Examples of use

    Debug.Print Complement(vbRed)

    Debug.Print Complement(Selection.Font.Color)
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •