vMenu Docs
API Reference

Theming and banners

A theme is a stylesheet that overrides MenuAPI's colours, radius, shadow and font. A banner is an image file that replaces the picture at the top of a menu.

A theme is a stylesheet that overrides MenuAPI's colours, radius, shadow and font. A banner is an image file that replaces the picture at the top of a menu.


Themes

Your stylesheet loads after MenuAPI's, so it wins on equal specificity without !important. Tokens you do not set keep their default.

Themes are for recolouring the menu, moving or resizing it is not supported. The instructional buttons are the exception, their sizes and spacing are tokens too.

Write one

/* themes/midnight.css */

#menuapi {
  --menuapi-rows-bg: rgb(12 18 38 / 82%);
  --menuapi-row-selected-bg: rgb(84 148 255 / 92%);
  --menuapi-row-selected-text: rgb(255 255 255);
}

The #menuapi selector is required, the tokens live there. Add the folder to fxmanifest.lua:

files {
    'index.html',
    'menuapi/**/*',

    'themes/**/*',
}

Apply it

NuiTuning.RegisterTheme("midnight", "themes/midnight.css");
NuiTuning.RegisterTheme("sunset", "themes/sunset.css");

NuiTuning.SetTheme("midnight");
NuiTuning.SetTheme("sunset");   // hot swap, applies next frame
NuiTuning.SetTheme(null);       // default look

Paths are relative to your index.html. The new sheet loads before the old one is dropped, so a swap never flashes.

MemberNotes
RegisterTheme(name, path)Same name again repoints it
UnregisterTheme(name)false if it was not registered. Clears the applied theme if it was that one
SetTheme(name)null for the default. Throws ArgumentException on an unregistered name
ThemeApplied theme name, or null
ThemesRegistered names
NuiTuning.Reset()Clears the applied theme, keeps registrations

For one fixed theme, skip the C# and add a <link> to index.html after MenuAPI's two stylesheets.

Tokens

Defaults are the game's own values.

Shape, shadow, font

TokenDefault
--menuapi-radius0px
--menuapi-shadownone
--menuapi-font"GTA Chalet", "Helvetica Neue", Arial, sans-serif

The banner title font is not themeable, because each title font has its own measured size and offset. Use Menu.MenuTitleFont.

Subtitle

TokenDefault
--menuapi-subtitle-bgrgb(0 0 0 / 98%)
--menuapi-subtitle-textmenu text colour
--menuapi-freemodegame's freemode colour (GTA Online blue)

--menuapi-freemode replaces --menuapi-subtitle-text on a freemode subtitle.

Rows

TokenDefault
--menuapi-rows-bgrgb(0 0 0 / 70.5%)
--menuapi-row-textmenu text colour
--menuapi-row-selected-bgrgb(255 255 255 / 88%)
--menuapi-row-selected-textrgb(0 0 0)
--menuapi-row-disabled-textrgb(109 109 109)
--menuapi-row-selected-disabled-textrgb(50 50 50)
TokenDefault
--menuapi-header-textmenu text colour
--menuapi-slider-dividerrgb(255 255 255)
--menuapi-overflow-bgrgb(0 0 0 / 70.5%)
--menuapi-desc-bgrgb(0 0 0 / 70.5%)
--menuapi-desc-rulergb(0 0 0 / 78%)

Stats panels

TokenDefault
--menuapi-stats-bgrgb(0 0 0 / 70.5%)
--menuapi-stat-trackrgb(100 100 100 / 70.5%)
--menuapi-stat-valuergb(255 255 255)
--menuapi-stat-upgradergb(93 182 229)
--menuapi-stat-upgrade-reducedrgb(224 50 50)

Colour picker panel

TokenDefault
--menuapi-panel-bggame panel colour
--menuapi-panel-accentgame accent, as r, g, b rather than a colour
--menuapi-panel-textmenu text colour
--menuapi-panel-swatch-selectedrgb(255 255 255)
--menuapi-panel-opacity-barrgb(136 136 136)

Instructional buttons

The button hints in the bottom right have their own element, so these tokens go on #menuapi-buttons instead of #menuapi. The defaults copy the game's own button bar. The same theme file can hold both, and the hints keep the theme even while no menu is open.

#menuapi-buttons {
  --menuapi-buttons-bg: rgb(12 18 38 / 90%);
  --menuapi-buttons-radius: 12px;
  --menuapi-buttons-key-bg: rgb(84 148 255);
  --menuapi-buttons-key-text: rgb(255 255 255);
  --menuapi-buttons-item-direction: row-reverse;
}

The bar

TokenDefault
--menuapi-buttons-bgrgb(0 0 0 / 85%)
--menuapi-buttons-bordernone
--menuapi-buttons-shadownone
--menuapi-buttons-radius4px
--menuapi-buttons-padding0 6px
--menuapi-buttons-height40px, the height of one row of hints
--menuapi-buttons-row-gap5px, the space between two rows stacked on top of each other, see GlobalInstructionalButtons
--menuapi-buttons-move-duration250ms, how long a row takes to slide or fade in and out
--menuapi-buttons-offset-x0px, moves the bar left from the safe zone edge
--menuapi-buttons-offset-y0px, moves the bar up from the safe zone edge

Each hint

TokenDefault
--menuapi-buttons-item-padding0 10px
--menuapi-buttons-item-gap7px, the space between the text and its icons
--menuapi-buttons-item-directionrow, text first. row-reverse puts the icons first
--menuapi-buttons-separatornone, a border drawn between two hints, for example 1px solid white

Text

TokenDefault
--menuapi-buttons-font"GTA Chalet", "Helvetica Neue", Arial, sans-serif
--menuapi-buttons-font-size18px
--menuapi-buttons-font-weightnormal
--menuapi-buttons-textrgb(255 255 255)
--menuapi-buttons-text-transformnone, uppercase makes every hint upper case

Keyboard keys

TokenDefault
--menuapi-buttons-key-size25px, every icon is sized from this
--menuapi-buttons-key-gap4px, the space between two icons of one hint
--menuapi-buttons-key-radius3px
--menuapi-buttons-key-padding0 4px
--menuapi-buttons-key-bgrgb(240 240 240)
--menuapi-buttons-key-textrgb(0 0 0)
--menuapi-buttons-key-bordernone
--menuapi-buttons-key-shadownone
--menuapi-buttons-key-fontArial, "Helvetica Neue", sans-serif
--menuapi-buttons-key-font-size15px
--menuapi-buttons-key-font-weightnormal

Controller and mouse

TokenDefault
--menuapi-buttons-padrgb(58 58 58), the sticks, d-pad, bumpers and triggers
--menuapi-buttons-pad-textrgb(255 255 255), the letters and arrows on them
--menuapi-buttons-argb(110 180 60)
--menuapi-buttons-brgb(222 90 90)
--menuapi-buttons-xrgb(40 160 220)
--menuapi-buttons-yrgb(236 196 30)
--menuapi-buttons-mousergb(255 255 255)
--menuapi-buttons-mouse-linesrgb(0 0 0)
--menuapi-buttons-mouse-highlightrgb(140 140 140), the pressed mouse button

Everything else

TokenDefault
--menuapi-buttons-plusthe text colour, the + between two buttons that go together
--menuapi-buttons-unboundrgb(224 50 50), the ??? of a key that is not bound
--menuapi-buttons-missingrgb(255 0 0), the PlayStation tilt icons, which the game has no picture for either
--menuapi-buttons-spinnerrgb(235 235 235)
--menuapi-buttons-spinner-altrgb(240 160 30), the orange spinner
--menuapi-buttons-spinner-speed1s, the time one turn takes

Out of reach

Colours set from C# are inline styles and always beat the theme. That covers MenuItem text colour and MenuSliderItem.BackgroundColor / BarColor. Stop setting them in C# if the theme should own them.


Banners

Both routes use the menuapi-banners folder next to your fxmanifest.lua. Do not put it inside menuapi, that folder is rewritten on every build.

files {
    'menuapi-banners/**/*',
}

Replace a game sprite

Name the file after the sprite: the dictionary is the folder, the texture is the file name. Every menu drawing that sprite picks it up, no C# needed.

menuapi-banners/commonmenu/interaction_bgd.png    <- the default banner
menuapi-banners/my_textures/my_banner.png         <- a Menu.HeaderTexture you set

Point one menu at your own image

Set Menu.HeaderImage to any name. The extension is optional.

Menu menu = new Menu("Outlaws", "Gang menu") { HeaderImage = "outlaw" };

menu.HeaderImage = "gangs/outlaw";   // subfolders are fine
menu.HeaderImage = null;             // back to whatever it would have shown

An image in another resource

An http, https or nui url is used as is, so the banner can live in another resource. It still has to be in that resource's files. Anything else is a name inside menuapi-banners.

menu.HeaderImage = "https://cfx-nui-my-theme-pack/banners/outlaw.png";

Resolution order

First one that exists on disk wins:

  1. Menu.HeaderImage
  2. An image named after the game sprite
  3. The game sprite

A missing file falls through, so a typo leaves the old banner instead of an empty header.

Files

.png, .jpg, .webp, tried in that order. Use png for transparency.

The banner is 500x110 at 1080p and the image is stretched to fill, so use roughly 1000x220 and keep that aspect ratio.

A menu created with a null title has no banner to replace.

When something is wrong

SymptomCause
Nothing changes at allThe folder is not in files
Still the game artworkWrong path, it is case sensitive
Your file vanishedYou put it inside menuapi

The default banner is resolved at page load. Others resolve the first time a menu using them opens, then are cached for the life of the page.

On this page