I propose to add a
toHSV method to Color3, and deprecate the
Instead of doing this:
local color = Color3.new() local h, s, v = Color3.toHSV(color)
Users do this:
local color = Color3.new() local h, s, v = color:toHSV()
The DevHub indicates that
toHSVis “static”, but offers no explanation as to what this means.
toHSVis the only such function of its kind. The concept of static functions has no precedent; they are not a regular pattern found in the Lua API.
toHSV, receiving a Color3 as its first and only argument, might as well be a method; a well-established pattern in the Lua API with plenty of precedent.
- First-time users will expect it to be a method. They will be confused when they find that it isn’t.
- Not having to introduce an entire concept for the sake of a single static function that might as well be a method is a lot easier for documentation writers.
Color3.toHSVfunction is the reverse of the
Color3.fromHSVconstructor, so that means they have to have matching APIs. Established patterns be damned.