Custom colors

With the themes extension and semi-transparent black and white shades, changing the color scheme of your mobile menu has always been easy.

In this tutorial, we're going to change the look of our menu by overriding CSS variables. Just follow the tutorial step by step and you'll have it up and running in no time.

Create the menu

Lets start with creating a .html file and add the markup for the page and the menu. If you need help with this part, please read the off-canvas menu tutorial first.

<nav id="my-menu">
        <li><a href="/">Home</a></li>
        <li><a href="/about/">About us</a></li>
        <li><a href="/contact/">Contact</a></li>
        "DOMContentLoaded", () => {
            new Mmenu( "#my-menu" );

Add CSS variables

To override the colors used by the plugin, simply override the CSS variables somewhere in your document. Most commonly, you'd write these styles in a separate .css file, but for this tutorial we'll write them in an inline <style />. Note that these styles should be included in the page AFTER the default mmenu .css file.

The example below will change the background color to #eee and the text color to #111 for all parts of the menu. For a complete overview of all available CSS variables, have a look at CSS documentation.

    .mm-menu {
        --mm-color-background: #eee;
        --mm-color-text: #111;

Mix it up

Because CSS variables are cascading, they can be overriden for each part of the menu (or for each <div>, <ul>, etc). The example below overrides colors for the navbar and the panels.

    .mm-navbar {
        --mm-color-background: #4bb5ef;
        --mm-color-text-dimmed: #fff;
        --mm-color-button: #fff;
    .mm-panel {
        --mm-color-background: #e0f2fc;
        --mm-color-text: #222;
        --mm-color-button: #4bb5ef;

Next tutorial:
Dynamic content