CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Color Selection

  1. #1
    Guest

    Color Selection

    Is there a standard formula that can be used to determine which color text would look good on a selected background color?
    I am using the standard Color picker dialog box to let the user select a color for label, but I will want to display some text on
    that label. I don't want to make the user pick the text color too, but I want it to be readable regardless of the color chosen. I
    would happy to use just black or white. For example, white looks good on dark colors, but bad on White, Yellow or many lighter
    colors. I am searching for a way to quickly determine whether to use Black or White text based on the RGB value returned.
    Any suggestions? Thanks!



  2. #2
    Join Date
    May 1999
    Location
    WA
    Posts
    236

    Re: Color Selection

    Try the 1's Complement of the RGB for your text color.

    Roger L. McElfresh

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured