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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:55:32+00:00 2026-05-26T23:55:32+00:00

Possible Duplicate: Algorithm to convert RGB to HSV and HSV to RGB? Can someone

  • 0

Possible Duplicate:
Algorithm to convert RGB to HSV and HSV to RGB?

Can someone explain on how to convert an HSV value to an RGB when the value is 0 to 255? Also,

For reference, I am trying to do this in C++.

  • 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-26T23:55:33+00:00Added an answer on May 26, 2026 at 11:55 pm

    Found it here
    http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript

    function hsvToRgb(h, s, v){
        var r, g, b;
    
        var i = Math.floor(h * 6);
        var f = h * 6 - i;
        var p = v * (1 - s);
        var q = v * (1 - f * s);
        var t = v * (1 - (1 - f) * s);
    
        switch(i % 6){
            case 0: r = v, g = t, b = p; break;
            case 1: r = q, g = v, b = p; break;
            case 2: r = p, g = v, b = t; break;
            case 3: r = p, g = q, b = v; break;
            case 4: r = t, g = p, b = v; break;
            case 5: r = v, g = p, b = q; break;
        }
    
        return [r * 255, g * 255, b * 255];
    }
    

    Edit:

    I once wrote a color picker and used to understand all these. Back then, I looked at photoshop color picker, tried moving around the cross hair, observe the changes in hsv/rgb numbers and figured out how they work. In this case i seems to locate at which point the main color, hue, is pointed it. The value of hue is actually a degree of fully saturated colors in cycle which starts with red and ends with red. There’s a triangle with each point representing R,G and B where 0 degree is R. Between R and G, it’s Yellow, between R and B, it’s Magenta and between B and G, it’s cyan. There we have total 6 colors. Those 6 colors are from case 0 through 5.

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

Sidebar

Related Questions

Possible Duplicate: Algorithm to convert RGB to HSV and HSV to RGB? I'm trying
Possible Duplicate: optimal algorithm for finding unique divisors I have asked this question before,
Possible Duplicate: Which sorting algorithm is used by STL’s list::sort()? Which sorting algorithm can
Possible Duplicate: Algorithm to find Lucky Numbers I came across this question.A number is
Possible Duplicate: Generating all Possible Combinations I'm trying to do a little algorithm in
Possible Duplicate: What Algorithm for a Tic-Tac-Toe Game Can I Use To Determine the
Possible Duplicate: Built in .Net algorithm to round value up to the nearest 10
Possible Duplicate: An algorithm to "spacify" CamelCased strings I have a string like this:
Possible Duplicate: Help with algorithm problem from SPOJ Came across this interview question. Given
Possible Duplicate: Algorithm for generating a random number is posible to generate a random

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.