Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6757651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:40:43+00:00 2026-05-26T13:40:43+00:00

I have a list of several different random colors values (no less than 1

  • 0

I have a list of several different “random” colors values (no less than 1 and no more than 8 colors). (Random means that there is no telling of their mutual “contrast”.)

Colors are given as RGB values (possible simplification: as H values in HSL model, or in some other color system of choice — I have some degree of control of how original colors are generated).

I need to compute a single one color value that is the most “contrast” (i.e. visually distinguishable) from all colors from the list.

A practical criteria for the contrast, for the case with 8 colors:

If we draw 9 squares, filled with our colors as follows:

[1][2][3]
[4][X][5]
[6][7][8]

Color of square X must be clearly distinguishable from all adjacent colors.

Possible simplification: reduce maximum number of colors from 8 to 4 (squares 2, 4, 5, 7 in the example, ignore diagonals).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:40:44+00:00Added an answer on May 26, 2026 at 1:40 pm

    I think the best solution could be:

    1. maximize hue difference with all the colors (simple linear optimization)
    2. maximize lighting
    3. maximize saturation

    http://www.colorsontheweb.com/colorcontrasts.asp

    Edit: with linear programming, you could give lower significance to the diagonal colors.

    Edit2: What maximization means:
    You want to maximize the hue contrast, that means the sum of all |Hi – result|, where Hi stands for Hue of color i, is to be maximized. You can even create conditions for minimum difference, e.g. |Hi – result| > Hmin. The actual calculation can be done by giving the equations to the linear optimization algorithm or you can try all hue values between 0.0 and 1.0 stepping by 0.05 and saving the best result.
    http://en.wikipedia.org/wiki/Linear_programming.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object in a list that I need to rank several different
I have several list view controls, each with many columns that I'd like to
I have a Rails app representing a card game. There are several different types
I have a JSF converter that I use for a SelectItem list containing several
I have tried several different ways, but it seems that it never sends the
I have a factory that processes a custom message format. Several different message sets,
We have a legacy website that several different users can log in to and
The facts: I have two predominant classes: Manager and Specialist. There are several different
I have a list on SharePoint with several hundred items in it. I also
I have a list of objects, IList<O> . O has several properties but only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.