Skip to main content

Styling

VP Audio Player provides a skin configuration object that controls colors, backgrounds, borders, the logo, the seek slider, button visibility, and button colors. All styling is configured under config.skin.

Background

The background object controls the background of the player. You can use a solid color, a gradient between two colors, or the audio's thumbnail (optionally blurred).

vpAudioPlayer("audio-background").setup({
audio: {
file: "the_audio_file_path"
},
config: {
skin: {
background: {
useThumbnail: false,
blur: false,
url: "",
primaryColor: "#011030",
secondaryColor: "#DF0028",
gradient: false,
gradientDirection: "H",
},
},
}
});
PROPERTYDESCRIPTION
background ObjectConfigures the player's background.
useThumbnail booleanWhen true, the audio thumbnail is used as the background.
blur booleanWhen true and useThumbnail is true, the thumbnail background is blurred.
url stringAn explicit background image URL. Overrides useThumbnail when set.
primaryColor stringThe primary background color. Used as the solid background or as the start color of the gradient.
secondaryColor stringThe secondary background color. Used as the end color of the gradient when gradient is true.
gradient booleanWhen true, the background is a gradient between primaryColor and secondaryColor.
gradientDirection stringThe gradient direction. Possible values: "H" (horizontal) or "V" (vertical).

Border

The border object configures the border around the player container.

vpAudioPlayer("audio-border").setup({
audio: {
file: "the_audio_file_path"
},
config: {
skin: {
border: {
width: 0,
radius: 12,
color: "",
},
},
}
});
PROPERTYDESCRIPTION
border ObjectConfigures the player's border.
width numberBorder width in pixels.
radius numberBorder radius in pixels.
color stringBorder color. Accepts any CSS color value.

Component Colors

The componentColors object defines the brand colors used by the player UI.

vpAudioPlayer("audio-components").setup({
audio: {
file: "the_audio_file_path"
},
config: {
skin: {
componentColors: {
primaryColor: "#FFFFFF",
secondaryColor: "#DF0028",
},
},
}
});
PROPERTYDESCRIPTION
componentColors ObjectConfigures the primary and secondary brand colors used by UI elements.
primaryColor stringThe primary brand color used by foreground UI elements.
secondaryColor stringThe secondary brand color used by accent UI elements.

The logo object lets you display a clickable logo inside the player.

vpAudioPlayer("audio-logo").setup({
audio: {
file: "the_audio_file_path"
},
config: {
skin: {
logo: {
state: false,
file: "the_logo_file_path",
onClickURL: "the_url_when_clicked",
},
},
}
});
PROPERTYDESCRIPTION
logo ObjectConfigures the logo displayed inside the player.
state booleanEnables the logo when true.
file stringURL of the logo image (PNG or SVG recommended).
onClickURL stringURL to open when the user clicks the logo. The logo is not clickable when this is empty.

Slider

The slider object configures the colors of the seek bar.

vpAudioPlayer("audio-slider").setup({
audio: {
file: "the_audio_file_path"
},
config: {
skin: {
slider: {
rail: "#9B9FAB",
progress: "#FFFFFF",
dragger: "#FFFFFF",
},
},
}
});
PROPERTYDESCRIPTION
slider ObjectConfigures the seek slider colors.
rail stringColor of the unplayed portion of the seek bar.
progress stringColor of the played portion of the seek bar.
dragger stringColor of the seek bar handle.

Text

The text object lets you override the color of the title, author, and default text.

vpAudioPlayer("audio-text").setup({
audio: {
file: "the_audio_file_path"
},
config: {
skin: {
text: {
title: "",
author: "",
default: "",
},
},
}
});
PROPERTYDESCRIPTION
text ObjectConfigures the text colors used inside the player.
title stringColor of the audio title text.
author stringColor of the audio author text.
default stringDefault color used for other text inside the player.

The menus object controls the appearance of toggle controls inside the settings menu.

vpAudioPlayer("audio-menus").setup({
audio: {
file: "the_audio_file_path"
},
config: {
skin: {
menus: {
toggle: {
default: "#FFFFFF",
off: "#CACACA",
on: "#206ED5",
},
},
},
}
});
PROPERTYDESCRIPTION
menus ObjectConfigures the menu UI styling.
toggle ObjectConfigures the colors of toggle controls (such as the autoplay toggle).
default stringThe default color of the toggle.
off stringThe color of the toggle when its state is off.
on stringThe color of the toggle when its state is on.

Buttons

The buttons object controls both the visibility and color of each player button. Setting state: false on a button removes it from the control bar.

vpAudioPlayer("audio-buttons").setup({
audio: {
file: "the_audio_file_path"
},
config: {
skin: {
buttons: {
backgroundColor: "",
color: "",
playbackButton: { color: "" },
volumeButton: { state: true, color: "" },
skipButtons: { state: true, color: "" },
settingsButton: { state: true, color: "" },
nextBackButtons: { state: true, color: "" },
playlistButton: { state: true, color: "" },
collapseButton: { state: true, color: "" },
},
},
}
});
PROPERTYDESCRIPTION
buttons ObjectConfigures visibility and colors of player buttons.
backgroundColor stringBackground color applied to all player buttons.
color stringDefault icon color applied to all player buttons.
playbackButton ObjectConfigures the play/pause button color.
volumeButton ObjectConfigures the volume button. state toggles visibility; color overrides the icon color.
skipButtons ObjectConfigures the skip-forward and skip-back buttons. state toggles visibility; color overrides the icon color.
settingsButton ObjectConfigures the settings button. state toggles visibility; color overrides the icon color.
nextBackButtons ObjectConfigures the next and previous audio buttons (for playlists). state toggles visibility; color overrides the icon color.
playlistButton ObjectConfigures the playlist button. state toggles visibility; color overrides the icon color.
collapseButton ObjectConfigures the collapse button used to switch between default and alternate grid layouts. state toggles visibility; color overrides the icon color.

Theme

A higher-level config.theme property lets you switch to a packaged theme without configuring the individual skin properties.

vpAudioPlayer("audio-theme").setup({
audio: {
file: "the_audio_file_path"
},
config: {
theme: "minimal",
}
});
PROPERTYDESCRIPTION
theme stringThe packaged theme to apply. Leave empty for the default theme, or set to "minimal" for the minimal theme.

Font

The font object controls the font used by the player UI. The player also respects a window.vpAudioPlayerFont global if you want to inherit the page's font.

vpAudioPlayer("audio-font").setup({
audio: {
file: "the_audio_file_path"
},
config: {
font: {
family: "Roboto",
url: "https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap",
},
}
});
PROPERTYDESCRIPTION
font ObjectConfigures the player UI font.
family stringThe font family name applied to the player.
url stringURL of the stylesheet that defines the font face. Loaded once per page.