G.HSVToColor

From GMod Wiki

Jump to: navigation, search
Function
Syntax HSVToColor( Number Hue, Float Saturation, Float Brightness )
Where is this used?
Description:
Calculates the RGB equivalent of the input HSV color
Returns: Color color
Part of Library: Global Functions
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.HSVToColor]G.HSVToColor [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Example

DescriptionCreate a colored box with HSV colors instead of RGB
Used onNewerClient.png
Code
function HSVtest()
 
	local color = HSVToColor(140, 1, 1)
	// Hue is valid from 0 - 360
	// Saturation is valid from 0 - 1
	// Value is valid from 0 -1
 
	surface.SetDrawColor(color.r, color.g, color.b, 255)
	surface.DrawRect(ScrW()/2-50, ScrH()/2+50, 100, 100)
 
end
hook.Add("HUDPaint","HUDHSV",HSVtest)
OutputN/A


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox