I run a small Valorant highlight community, and the feature I did not expect to enjoy building was a crosshair preview. Users paste a crosshair code, and the browser draws it before they ever open the game. The interesting part is that you do not need the game, an image, or a screenshot to do it. The code already contains every number the renderer needs.
Here is what the string actually looks like, and what broke the first time I drew one.
The format
A code looks roughly like this:
0;P;c;5;h;0;0t;1;0l;2;0o;2;0a;1;0f;0;1b;0 Split on ; and it reads as a tiny key-value list:
-
0— format version. -
P— start of the profile block. - everything after that is pairs: a short key, then a value.
The keys I care about:
| key | meaning |
|---|---|
c | color index (fixed palette) |
u | custom color as a hex string, used when the index points at custom |
h | whether the center dot is drawn hollow |
0t 0l 0o 0a 0f | inner line thickness, length, offset, opacity, and whether it is drawn |
1b 1t 1l 1o 1a | the same five for the outer line plus an outline flag |
Values are small integers or floats, and every one of them is a dimension in the game's own units. Nothing in the string says "pixels" — which is exactly why the same code looks different on a 1080p and a 1440p monitor.
Two practical parsing notes:
- Validate the head, not the tail. If the first token is not
0or the profile marker is missing, the string is garbage and you should say so rather than draw a blank crosshair that looks like a bug. - There is an optional
ssegment for share metadata before the profile block. Skip it positionally; do not assume the fourth token is the first setting.
Drawing it
The renderer is about forty lines of canvas:
const unit = canvas.width / 40; // one "game unit" scaled to the canvas const cx = canvas.width / 2, cy = canvas.height / 2; Pick a fixed unit relative to the canvas, not an absolute pixel count. Every dimension in the code is relative to the same grid the game uses, so scaling by canvas width is enough to keep previews consistent across cards, thumbnails and the detail view. Drawing in absolute pixels means your thumbnail and your full-size preview disagree about how thick the lines are.
Then it is rectangles: the center dot as a filled square, each line as a rect offset from center by its offset value, with globalAlpha set from the opacity key and fillStyle from the palette. Outlines are the same rects inflated by one unit and drawn behind.
Three things I would do differently:
- Draw the background first, and make it a gradient. A crosshair preview on flat white lies to you. Users judge visibility against a wall, a smoke, a dark corner. A soft gradient catches the crosshairs that vanish against light surfaces.
- Show the raw code next to the drawing. People debug their own paste more than you expect, and the code doubles as the copy target.
- Say out loud that the preview is approximate. Mine is drawn from the values in the string, not captured from the game, so spacing and edge softness differ slightly. One sentence on the page ended a whole class of "your preview is wrong" reports.
The honest limitation
A crosshair code carries geometry and color. It does not carry the player's resolution, aspect ratio or FOV, which is why copying a code from a streamer does not reproduce what you saw on stream. If you want a preview to be more than a toy, that is the variable you would have to ask for — and most users will not know it, which is a good reason to keep the preview a starting point rather than a promise.
The live version is the crosshair section on vtgo.gg if you want to paste a code and see it parse. Everything above is the whole trick: a string of key-value pairs, a unit derived from canvas width, and rectangles.
I build this as a solo developer; the site is a fan project for VALORANT highlights and is not affiliated with Riot Games.

