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 6564349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:57:20+00:00 2026-05-25T13:57:20+00:00

For my program I am trying to create a function that will generate an

  • 0

For my program I am trying to create a function that will generate an array of colors (should be the same each time so no randomness) where each colors is much different from the other colors.

Why might you ask? Well, because the user can add custom items to a user control and with the addition of each item the item should be associated with a specific color.

Obviously this would be bad:

Red
Dark Red
Light Red
Pink

Because visually all of these are quite similar in tint and color and the user would not be able to differentiate them. Ideally the function would yield something like this:

Red
Dark Green
Light Cyan
Orange

In this case each color is much different from the other colors and the user can easily tell them apart visually.

However, I’m having a bit of trouble coming up with an algorithm that does this. I know I want to use Color.FromArgb but I’m not exactly sure how to construct the loops where each item is much different from the others yet it is the same each time the function is ran. The modulus operator might be helpful.. I have been messing around with different approaches but each there is always a color too similar to another color in the array. I want to do it with a loop but that seems to kind of imply a pattern and a similarity in either tint, hue, or brightness between all the colors.

I suppose I could hardcode a ton of values but I’d really rather not.. =X

Well, if any of you have an idea please let me know! Thanks!!

  • 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-25T13:57:20+00:00Added an answer on May 25, 2026 at 1:57 pm

    There may be a really cool method for this, but if nobody turns one up, you can probably brute force it easily enough. Something you can try is to just space the RGB values out as much as possible. The one downside is that you will probably get some garish colors. I think you can get around that by offsetting a bit but you’ll need a bit of testing.

    For example….

    8 widely spaced colors could look like this. Note that D0 and 50 are 80 apart or as wide as you can get in an 8-bit space but give different options than 00 and 80, which IMO are horrible colors.

    D0D0D0
    50D0D0
    D050D0
    D0D050
    5050D0
    50D050
    D05050
    505050

    If you need more colors, you can make the interval smaller. All permutations with 3 8-bit values instead of 2 for each word would give you 27 variations (3^3) which should be enough in most cases. In that case, space your numbers about 55 (hex) apart from each other. 4 8-bit values goes to 64 colors (4^3) which certainly will do.

    The only other problem I see is that some of the darker colors will be hard to distinguish so you may want to cheat your values towards the lighter end. But I think instead if you simply skip the darkest color (which will be dark gray) the others should all work and be distinguishable relative to each other.

    The algorithm to generate the colors should be fairly simple once you decide which values to rotate among the three words.

    Final Note: I reiterate that this is quick and dirty and I defer to any existing method that someone can point to. Just trying to give the OP an option that might be sufficient.

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

Sidebar

Related Questions

I am trying to create a program that will do some simple calculations, but
I have been trying to create a Ruby program that will be running online
I'm trying to create a program that takes a text file of c++ code
I'm currently trying to create a program that estimates location based on signal strength.
I'm currently trying to create a kernel module that will produce data based on
I am trying to improve my C++ by creating a program that will take
I'm using VB.net so keep that in mind. I'm trying to create a program
I am trying to create a simple phonebook program that reads data from a
I'm trying to create a hotkey toggle(f12) that will turn on a loop when
My program is trying to create an key on the HKLM\Software\Microsoft\Shared Tools\MSCONFIG\startupreg\test\ but instead

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.