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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:00:34+00:00 2026-06-16T22:00:34+00:00

I’m making an app that requires the user to select multiple colors from a

  • 0

I’m making an app that requires the user to select multiple colors from a color picker and set the probability that some colors will have more than equal chance to be selected.

An example: Let’s say user selects the colors red, green and blue and selects that red should have 3 chances to be selected and the other tow only 1.
So in the end red will have a 60% chance , green 20% and blue 20%.

Now i want to do that but graphically and easy to understand.

I have a few ideas but i’m not sure which one is good …or easy…or whatever.

Idea 1:

picker1

The user selects which of the colors are more likely to get. The numbers are basically weights attached to every color.
The problem with this is that you can’t exactly have a full spectrum of colors ( all 16,777,216 of them) for obvious reasons…so you need to have relatively few colors (~150 or something).

Idea 2:

picker2

The user selects colors from areas. This is better because you can have full range of colors…but i can’t think of a simple way to have a color with more chance to be picked (like weights above).

These are just my flawed ideas. You can improve on these or give other ideas. A link to a color picker’s source code that does exactly what i want would be better though. 🙂

  • 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-06-16T22:00:35+00:00Added an answer on June 16, 2026 at 10:00 pm

    If I got you right, the user has to do the assignment between a color and a number/weight. I can see how that would easily work with Idea #1, but not with #2, since in the latter you don’t have a distinct color value to check against.

    The only think you could perhaps do, is to take the user shape input (those blobs) convert them into rectangles (or only allow those to begin with) and store them in your app with each rectangle having a weight assigned as well.

    Based on that information you can then calculate some “weight bands”:

    1. Assumption: three rects (doesn’t matter where they are on the screen, but for clarity sake I name the left, middle, right): left (weight 4), middle (weight 2), right (weight 6)

    2. Sum all weights (12)

    3. Find normalization factor to get from sum to range 0..1 -> factor = 1/12

    4. For each rect calculate normalized weight:

      L = 4 * 1/12 = 0.333

      M = 2 * 1/12 = 0.167

      R = 6 * 1/12 = 0.500

    => resulting three bands:
    #1 from 0.0 to 0.167
    #2 from 0.167 to 0.500 (= 0.167 + 0.333)
    #3 from 0.500 to 1.000

    1. Generate random value between 0 and 1, e.g 0.75.

    2. Compare random value, against the normalized weight bands -> 0.75 is between 0.5 and 1.0 -> third rect

    Now that you have found your relevant rect, get two other random values with the bounds being the min and max of X (for the first value) and Y (for the second value) coordinates of your determined rectangle (those rectangles were saved after the user drew those blobs/rectangles in the first place).

    Last step is to look up the color value in your above shown color range texture at those just generated new coordinates and voilà, you got your color determined based on the weight assigned to the rects.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build

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.