How to get matching colors?

I want to make a color sequence with two matching colors.

what i currently do is get 2 different colors math.random()

local Colors = {}
for i = 1, 2 do

	table.insert(Colors, Color3.new(math.random, math.random, math.random))

end

ParticleEmitter.Color = ColorSequence.new{ColorSequenceKeypoint.new(0, Colors[1]), ColorSequenceKeyPoint.new(1, Colors[2])}

This works but sometimes the colors are too “different”, i’d like they to match eachother.

I have no idea how to do this, does anyone have a suggestion?

What you need to do generate the first three values then the next 3 randoms that will be generated would be clamped to a range.

Example:

local FirstNumber = math.random(0, 255) --For first set of three
local secondNumber = math.random(FirstNumber-15, FirstNumber +15) --For second set of three

What are your criteria for what constitutes matching? Similar hue? Or similar saturation and value (e.g. both pastel)? Etc. Do you expect a gradient? I ask that because two identical colors would be considered a match by most usual criteria, but this may not be desirable, you may want some flavor of “close but not the same”, right?

To be honest idk how to put it exactly

I want a similar hue, i mean i just googled what hue means and i’m pretty sure that’s what i want.

I don’t mind if the ColorSequence ends up as a gradient but i also wouldn’t mind if it ends up looking kinda like the same color. It’s supposed to be random so both can happen