Affect an RGB value on the grayscale

Let’s say I have an RGB value:
local color = color3.fromRGB(200,200,200)

In the Roblox color editor, it has a grayscale bar.
image

Via a script, how would I change the color value I have in the same way, making it lighter or darker?

One thing I noticed: When I change the grayscale bar, the val of the HSV changes, I think that is what I need to use. Do I change the RGB to a HSV value, decrease/increase the val, and then change it back to RGB?

1 Like

What you could do is just decrease each number by 1 or by a percentage. That will make that specific color darker.

1 Like

Yes, generally all RGB colour selectors use the HSV format due to how easy it is to literally integrate with any type of UI like that.

Like Torten said, you can just take the position of the mouse vs. the absolute position of the UI Frame + half the size of it on the yAxis;

local value = 1 - (mousePosition.Y - frameAbsPosition.Y) / frameAbsSize.Y 

something like this works

1 Like