Repository navigation
API Reference
Two ways another plugin reaches CustomHUD: the CustomHUD.Panels.v1 shared interface, which shows panels, and directives, which a menu sends in raw nodes. Getting the interface, and sending directives: API Integration.
ICustomHudPanels in CustomHUD.Contract.dll, namespace CustomHUD.Contract, key CustomHUD.Panels.v1 (ICustomHudPanels.InterfaceKey). Every member is safe from any thread; Show and the Hide calls take effect on the next tick.
| Member | Description |
|---|---|
IReadOnlyCollection<string> Profiles { get; } |
Panel names the server can show: versus, ready, timeout, and any in its PanelLayouts
|
bool Show(int playerId, string profile, IReadOnlyDictionary<string, string> variables, IEnumerable<string>? classes = null, float? durationSeconds = null) |
Show or update a panel for one player. false for an unknown panel, or one without a File
|
void Hide(int playerId, string profile) |
Hide one panel for one player |
void HideAll(int playerId) |
Hide every panel the player has open |
void HideEverywhere(string profile) |
Hide one panel for every player |
-
variables: a variable left out keeps its last value. Clear one with"". -
classes:nullkeeps the classes from the lastShow; any other collection replaces them, so[]clears them. -
durationSeconds:nulluses the panel'sDurationSeconds;0or less keeps it up until hidden. - Panel names are case-insensitive.
- A player without a SteamID — a bot, or anyone Steam has not yet authorised — gets nothing, and
Showstill returnstrue. - A panel whose layout the player's Workshop addon lacks draws nothing, and
Showstill returnstrue. - Until CustomHUD has loaded,
Profilesis empty andShowreturnsfalse.
| Panel | Variables | Classes |
|---|---|---|
versus |
team1, team2, score1, score2, status, detail
|
live |
ready |
title, count, state, hint
|
is-ready, not-ready
|
timeout |
title, team, timer, detail
|
team-ct, team-t
|
A component sends directives in a raw node addressed to CustomHUD. Every other renderer ignores the node.
new MenuRawNode("customhud.panorama", "icon=7;danger")- Directives are separated by
;, so a text value runs to the next;. - A value that becomes a class name —
at=,view=,variant=,group=, the tones,glyph=,vglyph=,tagglyph=,swatch=,track=,tint=, anact=icon — must be 1–24 lowercase letters, digits or-. Anything else is ignored. - Unknown directives are ignored, so a node meant for a newer CustomHUD never breaks an older one.
-
customhud.panoramakeeps working on a server that renamed the renderer withRendererId. - Without a raw node, a row's text still splits on tabs:
"AK-47\t500 XP\t7"is the label, a right-hand value and an icon badge.
| Directive | Effect |
|---|---|
text=<text> |
Text only CustomHUD shows, at the node's place in the row. text=\t7 puts 7 in the value column |
icon=<N> |
A rarity dot or tile tint, 1–10
|
image=<key> |
A picture — Image keys |
tint=<token> |
With image=: a colour wash for art the game colours itself, such as graffiti |
type=<label> |
A small caption over the name, such as Rifle
|
bar=<N> |
A share, 0–100, as a meter |
chosen |
The player's own pick, such as their vote |
danger |
A red row |
disabled |
A dimmed row |
marquee |
A scrolling label |
| Directive | Effect |
|---|---|
at=<region> |
Place the entry in a region of the page layout: banner (5 slots), detail (28), detailbar (3), foot (4), aside (8), strip (10). Absent, unknown or full: the main list |
chip[=<tone>] |
A chip beside the title, up to 3. The text's first part is the value, the part after a tab its caption. The WeaponSkins locker joins them into one line at the right of its bar |
head |
Not drawn: its tab-separated text becomes the column heads, up to 6 |
section |
A heading across the page that starts a new line of cards. Text after a tab shows beside it |
group=<token> |
Adds grp-<token>. On a section, every entry up to the next section carries it |
view=<token> |
Draw the page as that view. The first entry with one wins, and PageViews wins over it |
variant=<token> |
Draw the view in a variant its stylesheet defines, such as compact on vip-grant. Mouse pages only |
inline |
Join the entry before it as a second button on its slot, such as Sell beside an owned item |
fold |
No slot on a mouse page, because another entry shows what it says. Keyboard pages still draw it |
The lists have one region, foot, with 3 slots.
| Directive | Effect |
|---|---|
sub=, unit=, tag=, tag2=, note=, mark=
|
More text: a line under the name, a small word after it, two pills, a note at the right, and the text in the mark square |
badge= |
A small boxed label under the name |
glyph=<icon> |
An icon from customhud_icons.vcss, ico-<icon>
|
vglyph=<icon> |
The value's own icon, such as a price's coin |
tagglyph=<icon> |
An icon inside the tag= pill |
vunit=<text> |
A smaller unit after the value: 45 then %
|
swatch=<colour> |
A colour dot: red, blue, green, yellow, purple, orange, pink, cyan, white, black, team or random
|
avatar[=<text>] |
The mark square with the name's initial, in a colour fixed per name, or the given text |
rating=<N> |
A CS Rating badge in its band's colour |
pips=<K>/<N> |
N pips, up to 20, K of them lit |
nays=<M> |
With pips=, M more lit after them, in red |
bar2=<N> |
A second meter, 0–100
|
lead |
The leading entry: a gold Leading tag, unless it has a tag of its own |
map |
Read the label as a map name, for its art |
hint |
On a header entry: its text replaces a mouse player's footer hint |
live=<menu id> |
On a header entry: the sidebar entry opening that menu gets a red dot |
| Directive | Tones |
|---|---|
tone= |
good, bad, gold, info, faint, main, ct, t. warn on a chip |
subtone= |
good, bad, gold, info, faint
|
badgetone= |
good, bad, gold, info, accent
|
tagtone=, tag2tone=
|
good, bad, gold, info, accent, ct, t, dark, legend
|
notetone= |
good, bad, gold, info, faint, accent
|
metertone= |
good, bad, gold, accent
|
Views add tone= values of their own: rank tiers r1–r7, Premier bands csr0–csr6 and levels l1, l2, l4, l8, l10, and MapChooser's extend, aim, awp, surf and ready.
| Directive | Effect |
|---|---|
verb=<word> |
The legend's word for the entry: select, pick, open, switch, edit, change, vote or apply
|
primary |
The page's main action, in views that draw one |
info |
A fact, not an action: no key and nothing to click. Added for you on a component whose selection does nothing. In a keyboard mode the cursor steps past it, unless the page holds nothing else |
submenu |
A › at the right. Added for you on a SubmenuComponent
|
act=<action>|<icon>[|danger][|off] |
A small icon button on the row's right end, in the page locker's list, up to 3. A click sends the row that action, as a key bound to it would: one the menu declares itself, taken by the row's HandleActionAsync. danger turns it red on hover; off dims it and makes it do nothing. Keyboard pages draw none |
divider |
No row; a rule in the sidebar. Added for you on a DividerComponent
|
kind=<kind> |
What the row is: input, toggle, slider, choice, selector or progress. Added for you on SwiftlyS2's components |
on=1, pct=<N>, num=<text>
|
With kind=: a toggle that is on, a slider's position 0–100, and its value as shown |
In a layout with a Card profile — the WeaponSkins lockers — a page whose first row carries hero draws as an inspect card.
| Directive | Effect |
|---|---|
hero |
On the first body row: the row is the card's name, type= its rarity line, image= its picture |
inline |
On a later row: join the field above as its slider bar, switch or clear button |
track=<preset> |
On an inline slider: adds track-<preset>. wear bands it with the five exteriors |
slot=<pick>|<image>|<name> |
On a row that opens a page, once per slot: a tile under its field showing image= art, named on hover. A click opens the row's page and picks the entry whose Tag reads as <pick>; an empty pick stops at the page. Drawn only by the WeaponSkins locker |
In a layout with a Spot profile — the WeaponSkins locker — a header entry marked spot draws over the list: the item the page is about. Other layouts leave it out of the title.
| Directive | Effect |
|---|---|
spot |
On a header entry: its text is the item's name |
fact=<label>|<value> |
A row of its table, up to 4 |
sub=, type=, note=
|
The line over the name, the grade under it in the grade's colour, and a status |
image=, icon=, chosen
|
Its picture, its rarity, and the status drawn as worn |
link=<entry>|<pick>|<label> |
A button labelled <label> under its table. A click opens the root menu's entry whose component id is <entry>, then the row there whose Tag reads as <pick>; an empty pick stops at the page. Back returns to the spotlight. Send it only while that entry is visible and enabled |
| Key | Picture |
|---|---|
A CS2 econ path, such as default_generated/weapon_ak47_cu_ak47_asiimov_light
|
That item's art |
map/<map> |
A stock map's screenshot, such as map/de_mirage
|
rank/skillgroup<N> |
The Competitive emblem, 0–18, or an icon 26283401–26283500 from Ranks' example icon addon |
rank/wingman<N> |
The Wingman emblem, 0–18
|
rank/level<N> |
A level badge, 1–10
|
Pictures draw in the lists, the page layout and the WeaponSkins lockers; the classic layouts have no picture slot. Sticker art draws only in WeaponSkins' layouts, and map/ and rank/ keys not in the WeaponSkins lockers.
| Element | Change |
|---|---|
| Title | Rules such as --- and ───, and a trailing colon, are dropped |
| Dividers | A body divider takes no row; only a sidebar draws one |
| Footer | Replaced by the mode's key legend or hint |
| Pages | Fixed pages instead of SwiftlyS2's scrolling window |
| Values | A toggle, input, slider or choice puts its value in the value column |
| Accepted input | The new value shows at once, in place of SwiftlyS2's two-second Accepted |
| Progress bars | A meter, with the share in the value column, instead of block characters |
| Text width | Not cut to MaxWidth: the layout ends it with an ellipsis at the row's edge, or scrolls it |