On this page

← All documentation

A first skin

A working skin in five minutes: skin.ts, one image, where skins live, the Skins page, the skin editor, and what an error looks like.

A skin sets how the playfield looks: the lanes, the notes, the receptors, the lights. It is a folder with one script, skin.ts, and the images the script names. The game runs the script at the start of every map, so the skin can react to the number of keys, the screen size or the song.

The skin

Create a folder first-skin with this skin.ts, and a 64 by 64 pixel PNG at notes/gem.png (white, on a transparent background: a rounded gem; any white PNG works):

/// <reference path="../../../mods/sdk/modding.d.ts" />

// First skin: dark lanes, pink gems, a pale frame around the stage. A skin is a folder
// with this file; its images are named by paths relative to the folder.
//
// Sizes are fractions of the screen height; `x` and `y` are fractions of the screen.

export default defineSkin({
  id: "first-skin", // 1 to 64 of a-z, 0-9, ., -, _ ; shares its namespace with mods
  name: "First Skin",
  version: "1.0.0",
  apiVersion: 2, // must equal the game's API version
  author: "Me",
  description: "Pink gems on dark lanes.",
  // `play` describes this launch: the skin runs again for every map.
  setup(play: PlayContext) {
    // Narrower lanes for the wide layouts, so that 9K still fits on the screen.
    const laneWidth = play.columns <= 6 ? 0.09 : 0.07;
    playfield.set({
      x: 0.5,
      y: 0.5,
      anchor: "center",
      laneWidth,
      laneGap: 0.004,
      laneHeight: 0.9,
      receptorY: 0.85, // the line where notes are hit, from the top
      scroll: "down",
      laneColor: "#10131ccc",
      borderWidth: 0.002,
      borderColor: "#f3d7e8aa",
      noteColor: "#ff4d94", // tints the image of the note
      noteSize: { width: laneWidth, height: laneWidth },
      note: "notes/gem.png",
      receptorColor: "#f3d7e8",
      pressedColor: "#ffffff",
    });
    // One lane of its own: the first column's notes are mint.
    lanes.set({ column: 0, lane: { noteColor: "#66e6bf" } });
    log.info(`First Skin: ${play.columns} columns, lanes ${laneWidth} wide`);
  },
});

What each part does:

  • export default defineSkin({ … }) declares the skin. id, name, version and apiVersion are required. id follows the rules of a mod id and shares its namespace with the mods: a mod and a skin cannot use the same one. apiVersion must equal the API version of the game (2). author, description, homepage, fonts and images are optional.
  • setup(play) runs at every map launch, on a fresh copy of the script. Nothing is kept from one map to the next. play tells you what is about to be played: mode, layout, columns (the number of keys), screenWidth and screenHeight in pixels, song and judgements. Name the parameter play, not ctx, which would hide the global ctx.
  • playfield.set({ … }) merges a description of the whole playfield. A field you do not give keeps the engine's default, so a skin that sets nothing draws the standard playfield.
  • lanes.set({ column, lane }) merges a description into one column, counted from 0. The first column's notes are tinted mint here; the others keep noteColor.
  • note: "notes/gem.png" names an image of the skin folder. Images are always paths relative to the folder. noteColor tints the image: a white image takes the colour exactly.
  • mine: "notes/mine.png" names the image of a mine, drawn at the note size with its own proportions; mineColor tints it. A skin without one draws the default skin's mine, so a skin never has to bring it.
  • Positions are fractions of the screen: x of its width, y of its height, from the top-left corner. Sizes and widths are fractions of the screen height, so the playfield keeps its proportions at every resolution. Colours are #rgb, #rgba, #rrggbb or #rrggbbaa.

The folder

first-skin/
  skin.ts            required, one file, at most 1 MiB
  notes/gem.png      images, always PNG
  fx/flash-1.png     frames of an animation, named with the {n} token
  preview.png        the picture the Skins page shows (else left.png)
  • skin.ts is a single script. It cannot import another file: loading import { W } from "./util" fails with Error resolving module './util'.
  • A folder without skin.ts is not a skin. The Skins page lists it as a problem.
  • Images are PNG files of at most 4 MiB and 2048 pixels per side. The game shrinks them to 640 pixels in its texture atlas, and a map loads at most 256 images for one layer.
  • An image used only inside a handler during the play must be loaded before the play starts: name it in setup, or list it in defineSkin({ images: [ … ] }) (64 at most).
  • Fonts (.ttf, .otf, 8 MiB at most each) are named in defineSkin({ fonts }). Key sounds (.wav, .ogg, .flac, .mp3, 1 MiB each) are named by hitSound.

Where skins live

Root Folder Notes
The game's skins\ next to prism.exe (in a source checkout, content/skins/) default and default-circle, shipped with the game.
The player's %LOCALAPPDATA%\Prism\PrismNG\data\skins\<id>\ Yours. PRISM_SKINS_DIR replaces this root only.

The game's skins are listed first, then the player's. The folder name is the skin's name on this machine: 1 to 64 characters, valid as a Windows file name, not starting with .. If two folders carry the same name, the first one wins and a message says so.

Copy your folder in:

Copy-Item -Recurse first-skin "$env:LOCALAPPDATA\Prism\PrismNG\data\skins\"

Since skin.ts is read again at every map launch, you edit it, save, and start a map: no restart. prism.exe --skin <id> picks a skin for a diagnostic run. See Tooling.

The Skins page

Open Skins from the menu. It lists the interface themes, then one card per skin with its preview, name, version, author and problems.

Control What it does
Use Makes the skin the one for the next map. The setting is skin. A change restarts the mod host, so it waits for the menu.
Customize skin On the card of the skin in use. Opens the skin editor on a demo chart.
Export Writes <id>.zip. Hidden files are left out.
Import… Installs a .zip as a new folder. It never replaces an existing skin: a taken name becomes -2, -3…
Open folder, Reload Open the player's root, and read the list again.
Actions menu Converts an osu! skin (Skin import), and assigns a skin per number of keys.

Only the player's skins can be deleted from the page, never the game's, and never the one in use.

The skin editor

Customize skin opens a frozen demo chart under the interface. Click the playfield, a column or a HUD widget to select it: the inspector shows what can be changed there. The editor draws its fields from the same catalogue as the skin fields reference, with the same bounds.

What the player edits is a separate layer stored in the settings (skinConfig), not in your files. The layers stack, and the highest wins, value by value:

  1. your skin,
  2. the map's script, if any,
  3. the player's own configuration.

So an edit never changes skin.ts, and Reset customizations brings the skin back as you wrote it.

When something is wrong

A skin that fails never stops the game. The game reports the problem and plays with the engine's own defaults, or with the default value of the one field at fault.

What is wrong What happens Message
skin.ts throws, does not declare itself, or has a wrong apiVersion The skin does not run: plain rectangles, no images. `skin.ts` must declare the skin with `export default defineSkin({ … })` at its top level
A number is out of its bounds It is moved into the bounds. laneWidth: 3 is outside [0.005, 0.5]; 0.5 is used
A colour is not a colour The default colour is used. noteColor: "pink" is not a color (#rgb, #rgba, #rrggbb or #rrggbbaa); the default color is used
An image is missing or is not a PNG That image is not drawn. The file name and the reason
A handler changes a field outside a play The call throws. the playfield only changes while a chart plays: call it from a handler between `game.songStart` and `game.songEnd`
A lane that does not exist The call throws. lane 40 does not exist: there are at most 32 lanes
No skin at all The engine's defaults. No skin found: put a skin folder in skins/

Like a mod, a skin that fails three times in a row, or overruns its 30 ms budget three times, is stopped. Unlike a mod, it comes back at the next map launch. Concepts explains the difference.

Next

  • Every playfield field, with its bounds and defaults: Skin fields.
  • Animations, lights, per-key skins, the player layer, the HUD elements a skin places: Skins.
  • Change the playfield during a play: playfield.update, and Map scripts for a script that belongs to one map.
  • Start from an existing skin: copy content/skins/default and change values.
  • Convert an osu! skin: Skin import.

Source in the game repository: content/examples/skins/first-skin/skin.ts,crates/skin/src/library.rs,crates/skin/src/prepare.rs,crates/skin/src/spec.rs,crates/modding/src/manifest.rs,apps/desktop/src/app/skins.rs,crates/modding/tests/docs_examples_start.rs