SonicFrame v1.3.2

Colors and CSS

Every color SonicFrame draws can come from your CSS. Set a few custom properties on any ancestor, and the waves, the buttons and every plugin follow, dark mode included.

Theming with custom properties

The system's light and dark switch is followed on its own. If your site switches with a class instead, call frame.refresh() (or the player's frame.refresh()) after the switch: canvas colors are read once, not every frame.

Colors in code

colors takes any CSS color or var(--name, fallback):

Color Default Used for
wave var(--sonicframe-wave, #c4cad4) Bars not yet played.
progress var(--sonicframe-progress, #2f6fdb) Bars already played.
hover 'auto' The band between the played part and the pointer (null shows none).
cursor null A line at the playing position.
waveHover, progressHover null Recolor the bars while the pointer is over the wave ('auto' nudges them).
knob null The dot riding the position (takes progress).

The focus ring

The wave is a focusable slider. Style its focus with :focus-visible on your container:

#wave:focus-visible {
    outline: 2px solid var(--sonicframe-progress);
    outline-offset: 2px;
}

The player's buttons draw their own ring for the keyboard, one line in the played color: on a button with a border it takes the border's place, and on one without it sits 2 px out, where the button's own fill cannot hide it.

Classes you can style

These classes keep their names from one version to the next, so a stylesheet can rely on them. Any other class inside a player is the library's own and may change.

Class What it is
.sonicframe-player A player's outer box.
.sonicframe-play The play button.
.sonicframe-time The time, whichever of time, elapsed, remaining and duration it shows.
.sonicframe-speed, .sonicframe-back, .sonicframe-forward, .sonicframe-volume The speed, skip and volume buttons.
.sonicframe-zoom-in, .sonicframe-zoom-out, .sonicframe-zoom-reset The zoom buttons.
.sonicframe-previous-chapter, .sonicframe-next-chapter, .sonicframe-chapters-toggle The chapter buttons, and the one that opens the list.
.sonicframe-chapter-now The name of the chapter playing.
.sonicframe-listen The button that reads the description aloud.
.sonicframe-under The rows under the wave.
.sonicframe-background The player's own background.
.sonicframe-chapters, .sonicframe-chapter The list of chapters, and each chapter in it.
.sonicframe-chapter-name Each title in the chapters' strip (lane).
.sonicframe-minimap The minimap's strip.
.sonicframe-recorder The recorder's outer box.
.sonicframe-record, .sonicframe-stop, .sonicframe-pause, .sonicframe-discard, .sonicframe-send The recorder's buttons.
.sonicframe-recorder-time, .sonicframe-recorder-wave, .sonicframe-recorder-player, .sonicframe-rec The time recorded, the live wave, the player of the recording and the REC badge.
.sonicframe-action, .sonicframe-action-<name> Each of your own recorder buttons.

The class .sonicframe-prev-chapter is still set beside .sonicframe-previous-chapter until 2.0.

Safe colors

Colors only ever reach properties that accept nothing but a color (the canvas, background-color, color, border), so a color from a user or a database can never make the page fetch an address. Variables are resolved in linear time, at most eight levels deep.

Every property, with what it paints, is in CSS variables.