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

  • SEARCH
  • Home
  • 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 6829269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:28:51+00:00 2026-05-26T22:28:51+00:00

I like the random color generation algorithm proposed here by David Crow , but

  • 0

I like the random color generation algorithm proposed here by David Crow, but I wonder if there’s a way to focus its results around a single color and regulate the results.

My program will be generating graphs that track a number of variables. Each variable belongs to one of 7 categories. I’d like to generate line-colors for these variables that are legible, unique and for which the hue, saturation and luminosity are within a proximate range of a root color which is associated with their category. For example, category Red’s variables would be various legible and discernible variations on red.

One solution might be to declare a root color, plus upper and lower boundaries for hue, saturation and luminosity. I could then randomly pull values from within those ranges, but is there a better way to hopscotch within those three dimensions so that the resulting colors have a decent amount of variation, but still leaving space to grow? For example, assume each pipe is a range value and each line is an iteration:

01 > |---------------|---------------|
02 > |-------|-------|---------------|
03 > |-------|-------|-------|-------|
04 > |---|---|-------|-------|-------|
05 > |---|---|---|---|-------|-------|
06 > |---|---|---|---|---|---|-------|
07 > |---|---|---|---|---|---|---|---|
08 > |-|-|---|---|---|---|---|---|---|
09 > |-|-|-|-|---|---|---|---|---|---|
10 > |-|-|-|-|-|-|---|---|---|---|---|
11 > |-|-|-|-|-|-|-|-|---|---|---|---|
12 > |-|-|-|-|-|-|-|-|-|-|---|---|---|
13 > |-|-|-|-|-|-|-|-|-|-|-|-|---|---|
14 > |-|-|-|-|-|-|-|-|-|-|-|-|-|-|---|
15 > |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|

What’s the best way to do this? Or is this even the best solution to my problem? A single graph may not plot more than 4 or 5 variables, but the number of variables which can be plotted could be in the hundreds.

Thanks for your help.

  • 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-26T22:28:51+00:00Added an answer on May 26, 2026 at 10:28 pm

    You can look at this as a sphere-packing problem in 3D: you want your colors a uniform distance from each other. The best arrangement for this depends on the number of variant colors you need, and finding an optimal solution is not simple. However, a simple mechanism might be to save a sequence of face-centered-cubic coordinates, starting at (0,0,0) and ordered by distance from this origin, and use them in sequence as offsets to your “base” color (scaled by a parameter which sets how different from each other they should look).

    If you want to pay maximal attention to detail, note that researchers in color theory and perception have measured the minimum discernible color difference, across the visible gamut. You can use this data adjust your color offset vector (using matrix multiplication, in lieu of the above-mentioned simple scaling), to ensure that your color differences look the same.

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

Sidebar

Related Questions

What is the best way to store a list of random numbers (like lotto/bingo
I would like to create a color generator based on random numbers, which might
I would like to set a random color for the text of a fadeIn/Out
So I'd like to generate a random background-color based on an array: def panel_color
Possible Duplicate: Random Color generator in Javascript I have some data I'd like to
I would like to have a JLabel changint color to a random one, while
I'd like to generate a random color, based on an original color and a
I have seen many places using Math.floor() and Math.random() like below $('a.random-color').hover(function() { //mouseover
I need to sample the pixel-color from an image, but it seems like I
I have a text file that looks a bit like: random text random text,

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.