RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Flowgraph Base ModuleFlowgraph Base NodeFlowgraph Base State NodeFlowgraph Node BuilderFlowgraph GraphFlowgraph Group HelperFlowgraph LinkFlowgraph ManagerNew Node TemplateFlowgraph PinFlowgraph States ManagerFlowgraph UtilsFlowgraph Variable Storage
Route Distance (Flowgraph Node)Closest Road (Flowgraph Node)Custom Lua (Flowgraph Node)Distance Between (Flowgraph Node)Waypoints Distance (Flowgraph Node)File Exists (Flowgraph Node)Get First Element of Table (Flowgraph Node)Get Level Data (Flowgraph Node)Get Map Objects IDs by DynField (Flowgraph Node)Get Table Value By Key (Flowgraph Node)GHOST (Flowgraph Node)Hide Loading Screen (Flowgraph Node)Color HSV (Flowgraph Node)Line Point From Xnorm (Flowgraph Node)Load Level (Flowgraph Node)Load Project (Flowgraph Node)On Menu (Flowgraph Node)Perlin Noise (Flowgraph Node)Pop Action Map (Flowgraph Node)Get Project InfoPush Action MapRandom ColorRandom NumberRandom QuaternionRandom VectorRoad PropertiesGet Navgraph RouteRoute PositionTemplate NodeTimeTimed SequenceTo NumberTo StringWorld Editor Open

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsflowgraphnodesutil

Random Color

- **Node Name:** `Random Color`

Overview

  • Node Name: Random Color
  • Category: repeat_instant
  • File: extensions/flowgraph/nodes/util/randomColor.lua

Generates a random color each frame. Supports a "cute color" mode that produces only highly saturated, vibrant colors.

Pin Schema

Input Pins

PinTypeDescription
cuteColorboolIf true, generates only highly saturated/vibrant colors
randomAlphaboolIf true, also randomizes the alpha channel

Output Pins

PinTypeDescription
colorcolorThe generated RGBA color as {r, g, b, a}

Internals

Key Methods

MethodDescription
work()Generates a random color each frame based on mode settings

Color Generation Modes

Normal mode: Each RGB channel is independently randomized with math.random() (0–1).

Cute color mode: Uses HSV color space for vibrant results:

  • Hue: fully random (0–1)
  • Saturation: biased high - lerp(1, 0.7, square(math.random())) - mostly near 1.0
  • Value: biased high - same formula - mostly near 1.0
  • Converts via HSVtoRGB() to produce saturated, bright colors

Alpha: Set to 1 by default, or randomized (0–1) when randomAlpha is true.

How It Works

  1. Determines alpha: random if randomAlpha is set, otherwise 1.
  2. If cuteColor is enabled:
    • Generates random HSV with high saturation/value bias using square(math.random()) distribution.
    • Converts to RGB via HSVtoRGB().
  3. Otherwise, generates three independent random values for R, G, B.
  4. Outputs the color as {r, g, b, a}.

Usage Example

-- Apply random colors to spawned vehicles:
-- [Spawn Vehicle] → [Random Color] cuteColor=true
--                     → color → [Set Vehicle Color]

-- Generate random colors with varying transparency:
-- [Random Color] randomAlpha=true → color → [Set Decal Color]

-- Direct Lua equivalent for cute colors:
local r, g, b = HSVtoRGB(math.random(), lerp(1, 0.7, square(math.random())), lerp(1, 0.7, square(math.random())))

Key Dependencies

  • HSVtoRGB() - engine function for HSV to RGB conversion
  • lerp(), square() - math utility functions

See Also

  • Route Distance (Flowgraph Node) - Related reference
  • Closest Road (Flowgraph Node) - Related reference
  • Custom Lua (Flowgraph Node) - Related reference
  • FlowGraph Guide - Guide

Push Action Map

- **Node Name:** `Push Action Map`

Random Number

- **Node Name:** `Random Number`

On this page

OverviewPin SchemaInput PinsOutput PinsInternalsKey MethodsColor Generation ModesHow It WorksUsage ExampleKey DependenciesSee Also