-1

Alright so the best way I can really explain this is on this site https://www.colorspire.com/rgb-color-wheel/ there is a color wheel when you first load the site don't move the little pointer in the square to select stuff. Just go to the bar that you can drag and drag it you'll see the r g b values change but you will also notice that one of the values is always 0, how can I recreate that but instead of the bar you drag you input a single 8 bit value (out of 255) so I can run the program with the value lets say 170 and it would somehow map that to a certain color.

2 Answers2

0

You are actually changing the hue when you move the bar so try this

import colorsys
color = input("Enter a value from 0-359:")
test_color = colorsys.hsv_to_rgb(color/360.0, 1, 1)

References

HSV to RGB Color Conversion

talhoid
  • 61
  • 9
0
    test_color = colorsys.hsv_to_rgb(int(value)/255.0, 1, 1)
    r, g, b = test_color
    r = (r * 255)
    r = math.trunc(r)
    g = (g * 255)
    g = math.trunc(g)
    b = (b * 255)
    b = math.trunc(b)
    fg.orange = Style(RgbFg(r, g, b))
    msg = fg.orange + str(f"  r = {r}, g = {g}, b = {b}")
    print(msg)