Modules / Styling

Styling: audio player theme styles

Theme Styles: Audio

Style every audio player on the site in one place, or one player on its own. Bricks' Audio element offers only a Light or Dark theme for its player, with no controls for its colors, icons or progress bar and no Theme Styles group. Kiln adds an Audio group to Theme Styles and a Player (Kiln) group to each Audio element.

#6 of 39 modules by votes

  • On by default
  • Needs Bricks 2.4 or newer
  • Tested with Bricks 2.4.3
Recording: in Theme Styles someone types in the audio player’s background, icon colour and track colour, and the player on the page restyles live.Recorded in Bricks 2.4.3

How to use it

Every player on the site

  1. Open the builder and go to Theme Styles.
  2. Open the Audio group.
  3. Under Player, set Background color, Padding, Border and Title typography, then:
    • Controls background: the strip behind the buttons, bar and time;
    • Icon color for the play, replay, pause, mute and unmute icons, and Icon hover color;
    • Icon size: Small (20px), Default (26px) or Large (32px).
  4. Under Progress bar, set Track color, Loaded color, Played color, Handle color, Bar height, Bar radius and Time typography.
  5. Under Volume, set Volume color and Volume track color.

Handle color applies to the progress handle and to the volume handle.

One player

  1. Select the Audio element and open its Style tab.
  2. Open Player (Kiln). It has the same controls as the theme group, except background, padding and border: use the element's own Background, Spacing and Border controls for those.
  3. Under Hide, turn off parts of this player: Hide title, Hide progress bar, Hide time and Hide volume.

What you set on the element wins over the theme style. Everything else keeps the theme style, with one catch: an Icon color set on the element also colors the icons on hover, unless you set the element's Icon hover color too.

Where it appears in Bricks

  • Theme Styles, in a group called Audio with the other element groups. It applies to every Audio element on the site.
  • Audio element, Style tab: Player (Kiln). It applies to that element only.

How it works with Bricks' styles

Bricks adds its own selectors to theme-style CSS before Kiln's filter runs, so Kiln's controls carry full selectors. Each one starts with .brxe-audio three times, which gives them a specificity of (0,3,0). With Bricks' cascade layer turned off, Bricks' own .brxe-audio.theme-light … rules would otherwise win, and these styles still win. The element group puts the element's own selector in front of the same, so it wins over the theme style, also inside a query loop.

Icon color and Icon hover color override the Light and Dark icon tint. The player's icons are white SVG backgrounds that Bricks tints with a brightness filter. When you choose an icon color, Kiln swaps them for the same SVGs used as masks over that color. A hover color alone swaps them only while the pointer is over the button.

Bricks fixes the controls background as transparent and the icons at 26px, both with !important inside its cascade layer, where Kiln's CSS can't outrank them. So Controls background paints the strip with an inset shadow, and Icon size scales each button with zoom, its spacing included.

Limits

  • The icon color rules embed Bricks' icon URLs, which include your site's domain. After a domain change, regenerate the CSS.
  • The theme group appears only while the Audio element is registered and Bricks has no Audio group of its own. If Bricks ships audio theme styles, Kiln's theme group steps aside. The Player (Kiln) controls on each Audio element stay.
  • Icon size stops at 32px: Bricks places the buttons inside a 40px strip, and a bigger icon would hang below it. A shadow you set on the controls strip with your own CSS replaces Controls background.

Settings

None. Turn the module on in Bricks > Kiln (it is on by default).

Requirements

Bricks 2.4 or newer.