How to preform arithmetic on a color value

Hello fellow developers,

I want to make a few text boxes around my main text box a darker color than the main text box. i want to do this automatically but im not able to preform an arithmetic operation on the color3 value.

DialougeBox.ImageColor3 = Color_Of_Dialouge
	
	local DarkerColor = Color3.new(Color_Of_Dialouge - Color3.new(0.33333,0.33333,0.3333))
	DialougeBox.NameBox.ImageColor3 = DarkerColor
	DialougeBox.Enter.ImageColor3 = DarkerColor
	-- The variable "Color_Of_Dialouge is another Color3 value

Any help would be greatly appriciated ^^

You have to perform the operation on each number individually, example:

local r = 255
local g = 255
local b = 255

local new_color = Color3.fromRGB(r - 100, g - 100, b - 100)

If you don’t want to clutter your code with multiple variables you could try an approach with tables:

local origin_color = {255, 255, 255}

local new_color = Color3.fromRGB(origin_color[1] - 100, origin_color[2] - 100, origin_color[3] - 100)

You could also use TweenService to change from one color to the other smoothly

click here for more information

thankyou. using tables worked. :3

Awesome, good luck, I recommend marking it as solved incase others in the future have the same issue.