Simply add the mkdocs configuration below to your mkdocs.yml (only the palette field is important if you want your page to have a theme toggle button).
Then, proceed to create a new file named extra.js in the same directory as the one mentioned in the mkdocs config file (extra_javascript field).
This is pretty much it, feel free to suggest any modifications by commenting on this gist.