How would I get a darker shade of a color3, using RGB

  1. What do you want to achieve? I’d like to achieve letting a user set a Color3 value in a settings script, which I’ve successfully done, but for one of the backgroundcolor’s on the GUI, I’d like it to be a darker version of the Color3 value.

  2. What is the issue? The issue is, when I do it, it sometimes comes out darker, but a different color.

  3. What solutions have you tried so far? I got the solution that I tried from here but that doesn’t seem to work the way I need it to.

Appreciate any help I get :slight_smile:

--Data.StillColor is what it is in the Settings script. 
--Getting the Color works, because it sets other BackgroundColor's to it, it is just getting this darker shade that I'm having trouble with.
ImageLabel.BackgroundColor3 = Color3.fromRGB((Data.StillColor.g*255)-.25,(Data.StillColor.r*255)-.25,(Data.StillColor.b*255)-.25)
1 Like

You put it as GRB instead of RGB

1 Like

I use this function in one of my old games for a custom button hover effect, I hope this can help:

-- `delta` can be any number within the constraint -255,255
-- negative = darker, positive = brighter
local function GetColorDelta(Color : Color3, DeltaSaturation : number): Color3
	local H, S, V = Color:ToHSV()
	return Color3.fromHSV(H, math.clamp(S + (DeltaSaturation / 100), 0, 1), V)
end

Here’s a video of it in action

6 Likes

That worked, thank you :slight_smile:

1 Like

Thanks, I can now see that lol.

1 Like