local function K(K)local U=(.2126*K.r+.7152*K.g)+.0722*K.b return U<.4 end local function U(K,U,E)local R=tick()while tick()-R<E do wait(1/MAX_STEPS)local t=K:Lerp(U,(tick()-R)/E)COLOR=Color3.new(t.x,t.y,t.z)if t.x<1 and(t.y<1 and(t.z<1 and(t.x>0 and(t.y>0 and t.z>0))))then script.Parent.Value=Color3.new(t.x,t.y,t.z)end end end while true do if tick()-t>=30 then math.randomseed(tick()/2)end t=tick()local E repeat E=BrickColor.Random()until not K(E.Color)print(E)U(Vector3.new(COLOR.r,COLOR.g,COLOR.b),Vector3.new(E.Color.r,E.Color.g,E.Color.b),2)end

local function IsDark(color)
	local cieLuminance = 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b
	return cieLuminance < 0.4
end

local function LerpColor(startColor, endColor, duration)
	local startTime = tick()
	while tick() - startTime < duration do
		wait(1 / MAX_STEPS)
		local lerpedVec = startColor:Lerp(endColor, (tick() - startTime) / duration)
		COLOR = Color3.new(lerpedVec.x,lerpedVec.y,lerpedVec.z)
		if lerpedVec.x < 1 and lerpedVec.y < 1 and lerpedVec.z < 1 and lerpedVec.x > 0 and lerpedVec.y > 0 and lerpedVec.z > 0 then
			script.Parent.Value = Color3.new(lerpedVec.x,lerpedVec.y,lerpedVec.z)
		end
	end
end

while true do
	if tick() - t >= 30 then math.randomseed(tick()/2) end
	t=tick()
	local newcolor
	repeat newcolor = BrickColor.Random()
	until not IsDark(newcolor.Color)
	print(newcolor)
	LerpColor(Vector3.new(COLOR.r,COLOR.g,COLOR.b),Vector3.new(newcolor.Color.r,newcolor.Color.g,newcolor.Color.b),2)
end
