Custom about surface.SetDrawColor

How would i make surface.SetDrawColor rotate through ever color?

I’m not sure how you would make it rotate since it is a function - but to answer your custom, you could store each of the color components in a variable and increment the value.



local red, green, blue

for red=0,255 do
    for green=0,255 do
        for blue = 0,255 do
            surface.SetDrawColor(red, green, blue)
        end
    end
end


Why you would want to do this though is beyond me.

Hope this helps!

i dont get what you just put up there to me it looks like just making them like local tm = LocalPlayer() or something

i mean so when its on your screen it goes through colors like Red then fades to green ect and keeps going

You mean something like this or what? I don’t really understand.



local hue, cr = 0, HSVToColor(0, 1, 1)
timer.Create("test_1", 0.1, 0, function()
    hue = (hue + 10) % 360
    cr = HSVToColor(hue, 1, 1)
end)
hook.Add("HUDPaint", "test_1", function()
    surface.SetDrawColor(cr)
    surface.DrawRect(10, 10, 120, 80)
end)


Use surface.SetDrawColor(HSVToColor(CurTime()*60 % 360, 1, 1))

Chess nut I didn’t understand what you sent unless your using something from mijyuoons code

To better explain what I’m asking so if the color starts at red it goes through it goes semi dark so like bright red fades down to dark red fades up to bright blue then dark blue then fades to bright green then dark green then fades to ( what ever color I type in with rgbh)

They knew exactly what you want, and they provided 3 different methods to do it.

Thanks you guys for this helped me a lot! solved