API ReferenceGE Extensionsflowgraphnodesutil
Color HSV (Flowgraph Node)
- **Node Name:** `Color HSV`
Overview
- Node Name:
Color HSV - Category:
simple - File:
extensions/flowgraph/nodes/util/hsvColor.lua
Creates a color using the HSV (Hue, Saturation, Value) color scheme. All input values are expected between 0 and 1.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
h | number | Hue (0–1, wraps around) |
s | number | Saturation (0–1) |
v | number | Value / brightness (0–1) |
a | number | Alpha; controls paint chrominess on vehicles |
Output Pins
| Pin | Type | Description |
|---|---|---|
color | color | RGBA color output as {r, g, b, a} |
Internals
Key Methods
| Method | Description |
|---|---|
init() | Empty initializer |
HSVtoRGB(h, s, v) | Wraps the engine HSVtoRGB() function with clamping |
work() | Converts HSV inputs to RGB, appends alpha, outputs color |
Clamping Behavior
- Hue is wrapped using
h - math.floor(h)so values outside 0–1 wrap around naturally. - Saturation and Value are clamped to 0–1 range with
math.max(0, math.min(1, x)). - Defaults:
h=0, s=1, v=1, a=1when pins are unconnected.
How It Works
- Reads H, S, V, A values from input pins (with defaults for nil values).
- Converts HSV to RGB using the engine's
HSVtoRGB()function. - Packs the result as
{r, g, b, a}and outputs as a color type.
Usage Example
-- Create a pure red color:
-- [Color HSV] h=0, s=1, v=1 → color → [Set Vehicle Color]
-- Animate hue over time for a rainbow effect:
-- [Timer] → normalized → h → [Color HSV] s=1, v=1
-- → color → [Set Vehicle Color]
-- HSVtoRGB can also be called directly in Lua:
local r, g, b = HSVtoRGB(0.5, 1.0, 1.0) -- cyanKey Dependencies
HSVtoRGB()- engine-level color conversion function
See Also
- Route Distance (Flowgraph Node) - Related reference
- Closest Road (Flowgraph Node) - Related reference
- Custom Lua (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide