Skip to content
The Technical ArtistArt. Code. Pipelines. Games.
Home/Tools/Colour & Ramp Converter
tool t-05
daily driver
client-side only

Colour & Ramp Converter

Convert colours between hex, sRGB bytes and linear floats, or build a gradient and export it as VEX, HLSL or Python. The conversions run in this tab.

How to use

Colour: pick or paste a colour, then copy the format your destination wants. The swatches compare the two interpretations: one is the colour, one is what happens when sRGB bytes get pasted into a linear slot. Ramp: add stops, place them from 0-1, and copy the generated VEX, HLSL, or Python.

01

Colour Converter

sRGB in -> linear out, both directions shown.
your colour
bytes pasted as linear (without sRGB decoding)
02

Ramp / Gradient -> Code

HLSL
On this page sRGB and linear colour Why Export Ramps As Code Privacy

sRGB and linear colour

Hex colours and 0 to 255 colour values are usually sRGB-encoded. Shader calculations normally need linear values. Dividing an sRGB byte by 255 only normalises the range; it doesn’t decode sRGB, so using that result as a linear value makes mid-tones too bright. This tool applies the piecewise sRGB conversion. Check whether your destination already converts the input before converting it yourself.

Why Export Ramps As Code

A code-based ramp is useful when you want editable stops and a readable change in version control. A texture ramp may be a better choice for painted detail or a complex curve. Compare the shader cost in context; a long chain of lerps isn’t automatically cheaper than a texture sample.

Privacy

Your input files and calculations are processed in this browser tab. The tool doesn’t upload them. The site uses Google Analytics for site usage; see how the site works.