<nav class="navbar">Title</nav>
    <div class="container">
        <div>
            <input type="button" value="Light/Dark" id="toggle-theme" />
            <label for="darkness">
                Darkness
            </label>
            <input type="range" id="darknessSlider" name="darkness" min="0.3" max="1" value="1" step="0.1" />
        </div>

        <h2 class="title">What is Lorem Ipsum?</h2>
        <p class="content">
            Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy
            text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen
            book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially
            unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
            and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
        </p>
    </div>
    <footer>
        Copyright 2018
    </footer>
 
        :root {
            --red-hue: 360;
            --blue-hue: 240;
            --green-hue: 120;

            --main-hue: var(--red-hue);
          --theme-darkness: 1;

            --nav-bg-color: hsl(var(--main-hue), 50%, 50%);
            --nav-text-color: hsl(var(--main-hue), 50%, 10%);
            --container-bg-color: hsl(var(--main-hue), 50%, 95%);

            --content-text-color: hsl(var(--main-hue), 50%, 50%);
            --title-color: hsl(--main-hue, 50%, 20%);
            --footer-bg-color: hsl(var(--main-hue), 93%, 88%);

            --button-text-color: hsl(var(--main-hue), 50%, 20%);
                      filter: brightness(var(--theme-darkness));
        }

        :root[theme='dark'] {
            --red-hue: 360;
            --blue-hue: 240;
            --green-hue: 120;

            --main-hue: var(--blue-hue);
            --theme-darkness: 1;

            --nav-bg-color: hsl(var(--main-hue), 50%, 90%);
            --nav-text-color: hsl(var(--main-hue), 50%, 10%);
            --container-bg-color: hsl(var(--main-hue), 50%, 95%);


            --content-text-color: hsl(var(--main-hue), 50%, 50%);
            --title-color: hsl(--main-hue, 50%, 20%);
            --footer-bg-color: hsl(var(--main-hue), 93%, 88%);

            --button-text-color: hsl(var(--main-hue), 50%, 20%);

            filter: invert(1) brightness(var(--theme-darkness));
        }
        div.container > div > label,input[type=range]{
            display: block;
        }
         
        * {
            margin: 0;
        }

        html {
            height: 100%;
        }

        body {
            height: 100%;
            font-family: -apple-system, BlinkMacSystemFont,
            “Segoe UI”, “Roboto”, “Oxygen”, “Ubuntu”, “Cantarell”,
            “Fira Sans”, “Droid Sans”, “Helvetica Neue”,
            sans-serif;
            display: flex;
            flex-direction: column;
        }

        nav {
            background: var(--nav-bg-color);
            padding: 1.3rem;
            color: var(--nav-text-color)
        }

        .container {
            flex: 1;
            background: var(--container-bg-color);
            padding: 1rem;
        }

        p.content {
            padding: 0.7rem;
            font-size: 0.7rem;
            color: var(--content-text-color)
        }

        .container h2.title {
            padding: 1rem;
            color: var(--title-color)
        }

        footer {
            background: var(--footer-bg-color);
            padding: 1rem;
        }

        input[type=button] {
            color: var(--button-text-color);
            padding: 0.3rem;
            font-size: 1rem;
        }
    
 
        const toggleBtn = document.querySelector("#toggle-theme");
        const darknessSlider = document.querySelector("#darknessSlider");

        toggleBtn.addEventListener('click', (e) => {
            console.log("Switching theme");
            if (document.documentElement.hasAttribute('theme')) {
                document.documentElement.removeAttribute('theme');
            }
            else {
                document.documentElement.setAttribute('theme', 'dark');
            }
        });
        darknessSlider.addEventListener('change', (e)=>{
            const val = darknessSlider.value
            console.log("Changing darkness", val);
            document.documentElement.style.setProperty('--theme-darkness', val);

        });

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.