How do i check if a color3 value exists in an UIgradient?

I am currently working on a color gradient menu but i need to figure out where to move the box whenever the color is changed via the hex value.

Is there a way to check if a color3 value fits in the UI gradient and what the timestamp would be of that color?
image
image
I need to know what the timestamp is of color3.FromRGB(255,146,0) in the UI gradient in this case.

ColorSequence.Keypoints

https://developer.roblox.com/en-us/api-reference/datatype/ColorSequence

That would get the Color3 value from a timestamp, i need to get the timestamp from a Color3 value instead.

Try listing the times that you’re looking for and I’ll try to help you the best way I can.

I need to move the black bar depending on what color is currently selected once you open the menu.

I would have to get the distance from the currently selected color on the UIgradient.

So for an example:
color3.FromRGB(255,146,0) would return 0.1
color3.FromRGB(255,255,123) would return 0.423
but those keypoints are not listed on the UIgradient.

1 Like

I would try to tamper with the times a little bit if you can.

(UIGradient - Roblox Tutorial - YouTube) I would watch this and see if it can provide you with the information needed.

Not very experienced with this kind of stuff, I am a little bit of a Newbie when it comes to figuring out stuff like this.

But I do try to help the best way I can with things.

Your gradient just looks like a hue gradient, maybe getting the Hue component of the color and working on percentage would be your key.
For example:

local color = Color3.FromRGB(255,146,0);
local h = Color3.toHSV(color);
bar.Position = UDim2.new(h, 0, bar.Position.Y.Scale, 0);
1 Like