Это руководство доступно на английском и французском.

The same player window in three layers: the structure, then colors and type, then the dressed window

Skins

English translation of SKINS.md, which is the reference: keep the two in step.

A skin changes Sunao's look and its structure. It's a folder of data, with no code at all: JSON, a stylesheet, fonts and images. It can neither read your data nor act on your behalf (see Security).

Three ways to make a skin:

Agent creating or editing a skin: read ui/skins/AGENTS.md, which gives the steps and the pitfalls.

Quick start

  1. Open the skins folder: Settings > Display > Skin > Choose a skin > Open the skins folder. It's <userData>/skins/:

    • macOS: ~/Library/Application Support/Sunao/skins/
    • Windows: %APPDATA%\Sunao\skins\
    • Linux: ~/.config/Sunao/skins/
  2. Create a my-skin/ folder in it with these two files:

    { "id": "my-skin", "name": "My skin", "author": "Me", "version": "1.0.0", "api": 1 }
    
    :root { --bg: …; --surface: …; --text: …; --accent: …; --radius: …; }   /* your own values */
    
  3. Check it from the app's repository: npm run skin:check -- <folder path>.

  4. Go back to the skins page and apply it. A rejected skin shows up there, with the reason.

  5. After each change, View > Reload (⌘R / Ctrl R) reads the stylesheet again.

  6. To see it in every state without touching the running app: SKIN=<folder path> npm run skin:shots (screenshots in /tmp/skin-shots/my-skin/, see Check).

If a skin makes the app unusable, View > Back to the default skin (⌘⌥0 / Ctrl Alt 0) restores the default skin. This menu belongs to the system: no stylesheet can hide it. It's also in the Dock menu on macOS. As a last resort, removing the skin's folder brings the app back to the default skin on the next launch.

Files

my-skin/
  skin.json      required: identity, layout, title bar
  skin.css       the stylesheet, loaded after ui/styles.css
  preview.png    gallery thumbnail, 16:10 (640×400 recommended)
  icon.png       the app icon while the skin is active (optional, see skin.json)
  fonts/, img/   everything skin.css loads, through relative url()s

The folder may be a symbolic link (handy to work on a skin kept elsewhere). Its files, however, can't point outside the folder.

skin.json

{
  "id": "my-skin",
  "name": "My skin",
  "author": "Me",
  "version": "1.0.0",
  "api": 1,
  "description": { "fr": "…", "en": "…" },
  "swatch": ["#…", "#…"],
  "icon": "icon.png",
  "titleBar": { "height": 40, "color": "#20202e", "symbol": "#ffffff", "buttons": "native" },
  "slots": ["lcd", "stop"],
  "layout": { … }
}
Key
id the folder's name: a-z, 0-9, -, 2 to 41 characters. An installed skin can't take the id of a shipped skin.
name, author, version text shown in the gallery (60, 60 and 20 characters at most). name is required.
api the contract version followed: 1. Any other value gets the skin rejected.
description one text, or one text per language (fr, en, es, pt, id, ru, ar, hi, bn, zh), falling back to English. 500 characters.
swatch up to 5 #rrggbb colours, shown instead of preview.png when it's missing.
icon relative path to a square PNG of 256 to 1024 px (1 MB at most) in the skin's folder, for example "icon.png". While the skin is active, it becomes the Dock icon on macOS and the window icon on Windows and Linux. Finder, Launchpad and Explorer keep the app's icon. An invalid icon gets the skin rejected.
titleBar the area where macOS places its traffic lights (centred vertically) and Windows its buttons (drawn in the color and symbol colours). height from 28 to 96 px. "buttons": "skin": the skin draws its own buttons (the window piece) and macOS hides its traffic lights; on Windows and Linux, the system buttons stay and the window piece is hidden.
slots only without layout: adds the display (lcd) and the stop button (stop) to the original player bar.
layout the app's structure (below). Without it, the original layout.
classic true for a classic skin (see below).

skin.json weighs 64 KB at most. Unknown keys are ignored.

Layout

A tree of rows and columns, where every leaf is a piece of the app:

{ "dir": "row", "class": "desk", "items": [
  { "dir": "column", "size": 440, "items": [
    { "part": "lcd" },
    { "part": "transport", "buttons": ["prev", "play", "pause", "stop", "next"] },
    { "part": "panel", "default": "queue", "grow": 1 }
  ] },
  { "part": "page", "grow": 1 }
] }
The example above, drawn: the .bureau row, a 440 px column (display, playback buttons, a panel taking the remaining height) and the page taking the remaining width
The example above, drawn: the .bureau row, a 440 px column (display, playback buttons, a panel taking the remaining height) and the page taking the remaining width
Key
dir row or column: a box, with items
part a piece (list below)
size fixed size along the parent's axis, in px
grow share of the remaining space along the parent's axis
min, max bounds along the parent's axis, in px
class up to 4 class names (a-z, 0-9, -) for skin.css

Boxes are div.box.box-row or div.box.box-column. Each piece is wrapped in div.part.part-<name>, which it fills. Depth: 10 levels, 120 nodes at most.

Piece Options
page the current page (home, song, creator, search…). Required.
topbar arrows, home, search, bell, account
nav links to the main pages, the current one marked .on (.nav-link.nav-<page>, icon and name) buttons: home, search, tags, charts, artists, playlists, liked, history, stats, settings
library library: liked songs, history, stats, playlists, followed creators rail: true: a column of badges, without header or handle; each item's name is in .lib-name, a .rail-sep rule separates your collections from the rest, the create button is .rail-create
panel the panel (now playing, lyrics, queue, devices), always open default: now, lyrics, queue or devices, the view shown when none is chosen
nowplaying, lyrics, queue, devices one panel view, fixed
player the original player bar, whole
track cover, title, creator, style, like cover: cover size in px (0: none)
cover the playing song's cover, which opens its page
transport playback buttons, in the given order buttons: shuffle, prev, playpause, play, pause, stop, next, repeat, like
seek position in the song
volume mute and volume
tools tool buttons, in the given order buttons: now, lyrics, queue, devices, mini, fullscreen, eq (turns the equalizer on), settings, search, clear
lcd full display: the next five pieces together
status playback state (playing, paused, stopped)
time elapsed time, or remaining on click, one element per character (see Stylesheet)
marquee scrolling title "1. Creator - Title (3:45)"
info bitrate (kbps), sample rate (kHz), model version, speaker
visualizer spectrum
milkdrop Milkdrop visualizations: one preset every 20 s, click for the next one
balance left-right balance; --b on .balance: distance from centre, 0 to 1
equalizer 10-band equalizer and preamp, curve, presets
window window buttons, with titleBar.buttons "skin" buttons: minimize, maximize, mini, close
drag empty strip that moves the window
spacer flexible space

page, topbar, library and panel are placed only once. An unknown piece, a missing page or a tree that's too big gets the skin rejected; unknown options are ignored.

Stylesheet

skin.css applies to the whole app: main window and mini player (.mini). It weighs 1 MB at most.

Starting tokens, on :root: --bg, --surface, --elev, --elev2, --hover, --line, --text, --muted, --dim, --accent, --accent-hi, --radius, --pill, --font, --menu-bg, --menu-hover, --side, --right, --bar, --top. These tokens recolor the original layout; a skin with its own identity usually also restyles the components and rearranges the layout.

Guaranteed hooks. The classes a skin can rely on are listed, by area, in skin-hooks.json: layout, top bar, navigation, library, pages, cards, song lists, detail pages, panel, player, equalizer, full screen, mini player, menus and dialogs, settings. A b-* pattern covers generated classes (b-play, b-next…). These classes exist in the interface (a test checks it) and won't change without a new contract version. Other classes, and the exact nesting of elements, may change with any update: npm run skin:check flags the ones your stylesheet uses.

On <html>:

On pages: .main[data-view] carries the name of the page shown (home, track, artist, tag, tags, charts, artists, search, liked, history, stats, playlists, playlist, mine, sunolist, settings, skins).

Song styles (the first terms of their prompt) are written on every card (.card-style) and under the playing song's title (.t-style). Hidden by default: a skin shows them with display: block.

Sliders: the position (0 to 1) is in --v. Volume and position: .slider > .rail (.buf, .fill) and .knob. Equalizer: .eq-band > .eq-track (.eq-fill, .eq-thumb), --v at 0.5 for 0 dB. These are ordinary elements, fully styleable (no <input>).

Spectrum: colours on .viz (--viz-low, --viz-mid, --viz-high from bottom to top, --viz-peak), bars in px (--viz-bar width, --viz-gap gap, --viz-step stepped rise, --viz-peak-size peaks).

Time: .lcd-time holds one <i class="d d-…"> per character: d-0 to d-9, d-colon, d-minus (remaining time) and d-blank (the minus sign's slot, hidden by default). A sprite sheet and background-position draw period digits.

Pixel placement: position: absolute on the pieces of a position: relative box, for example on a 550 × 232 grid.

Sound: as soon as a skin shows the spectrum or the equalizer, or the equalizer is set, sound goes through Web Audio and the spectrum shows the real sound. While casting to a speaker, the spectrum is simulated and the equalizer has no effect.

Motion: the app stays open for hours. A continuous animation should only run during playback (html[data-play=playing]) and stop under @media (prefers-reduced-motion: reduce).

Classic skins

"classic": true in skin.json, and the images of a period media-player skin (the contents of a .wsz, lowercase names): main.bmp (required), cbuttons.bmp, titlebar.bmp, eqmain.bmp, pledit.bmp, text.bmp, numbers.bmp, volume.bmp, balance.bmp, posbar.bmp, shufrep.bmp, monoster.bmp, playpaus.bmp, gen.bmp, viscolor.txt, pledit.txt. No stylesheet is read: ui/lib/classic.js cuts the images and ui/classic.css places them at the original player's positions. Only the colours (r,g,b, #rrggbb) and the font name in viscolor.txt and pledit.txt are read.

Security

What the app guarantees for installed skins. Each point is checked by test/skins-contract.mjs or test/skins.mjs.

A skin only reaches the files in its folder: remote addresses, @import, paths that leave it and code are refused
A skin only reaches the files in its folder: remote addresses, @import, paths that leave it and code are refused

What the app can't prevent:

The ⌘⌥0 / Ctrl Alt 0 shortcut has only been checked on macOS.

Contract and versions

The api: 1 contract covers: the skin.json format, the pieces and their options, the tokens, the hooks in skin-hooks.json, the states on <html> and .main[data-view]. While api is 1, these only grow: new pieces, options or classes may appear, none disappears or changes meaning. An incompatible change will move to api: 2, with the list of differences; the app rejects a skin whose version it doesn't know.

Check

From the repository's app/ folder:

Preview in the running app, for an agent or a tool: writing the skin's id into a .preview file at the root of the skins folder makes the app apply it. The app writes the outcome to .preview.json (accepted, or the reason it was refused) and a screenshot of the window to .preview.png, then reloads the skin on every save of its files; a change that breaks a rule is refused and the app keeps the last valid version.

Publishing from a tool: POST /api/skins on the Sunao website, with the zip as the raw body (content-type: application/zip) and a publishing token created on the account page (Authorization: Bearer sunao_…). Same checks as the form; JSON answer.

Before sharing a skin: