• 01 - Critter Models 02
  • 02 - VantaJS Shaders
  • 03 - App Bundle 02
  • 04 - Cathedrals
  • 05 - App Bundle 01
  • 06 - Retroscopic
  • 07 - Games
  • 08 - Voronoi
  • 09 - Terrain
  • 10 - Critter Models 01
  • 11 - Chromatophores
  • 12 - Conformal Maps
  • 13 - Echo Logix
  • 14 - Music
  • 15 - Colour Theory
MIKE'S NOTEBOOK
Notes
Number:
Project:
01Critter Models 02
└ Locust└ Butterfly└ Cockroach└ Spider└ Scorpion└ Dragon└ Brazilian Treehopper└ Tardigrade└ Diatoms└ Bumblebee└ Wasp└ Hammerhead Worm└ Giraffe Weevil└ Trilobite Beetle
02VantaJS Shaders
└ Clouds└ Waves└ Cells└ Rings└ Halo└ Globe└ Net└ Dots└ Birds└ Trunk└ Topology└ About VantaJS
03App Bundle 02
└ Gutindex└ Insect Builder└ OpenLayers
04Cathedrals
└ Lattice└ Lost└ Lucent└ Lumen└ Glass└ Disco└ Hyperion└ Latent
05App Bundle 01
└ Robohash└ PrismJS└ Horoscope└ Binary Jazz└ Morse Code└ URL Extractor└ Entity Escaper└ Phonetic Alphabet└ Toki Pona└ Semaphore└ Cut Up Machine└ Text Mixer└ Currency Freaks└ Host IO└ CrUX API└ Logo Dev└ Web Speech API└ GEO DB
06Retroscopic
└ Galaxy└ Ocean└ Slime└ 24-Cell└ Unicorn└ Polyp└ Oneiric 1└ Oneiric 2└ Node└ Torus Knot└ GLSL Grid└ Liquid Crystal└ Silky└ Butterfly└ Ocean 2└ Icosahedron└ Luma└ Swarm└ Broken Solid└ Hypersphere└ Constraints└ Psycho Killer
01 / 03

PRISMJS - INTERACTIVE APP SOURCE CODE

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
  <title>PrismJS</title>
  <style>
    *,
    *::before,
    *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    html,
    body {
      height: 100%;
      font-family: "Inter", system-ui, sans-serif;
      line-height: 1.6;
      margin: 0;
      padding: 0;
    }

    body {
      background: #000000;
      color: #ffffff;
      min-height: 100vh;
      position: relative;
      overflow-x: hidden;
      display: block;
      color-scheme: dark;
    }

    body::after {
      content: "";
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-image:
        linear-gradient(rgba(40, 40, 40, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(40, 40, 40, 0.1) 1px, transparent 1px);
      background-size: 40px 40px;
      z-index: -1;
      opacity: 0.3;
      pointer-events: none;
    }

    .blog-content {
      width: 100%;
      max-width: 1000px;
      margin: 0;
      padding: 1.5rem 0.75rem 1.5rem 30px;
    }

    .page-header {
      text-align: left;
      margin-bottom: 2rem;
      padding-bottom: 1.25rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .page-header .tagline {
      color: #ffffff;
      font-size: 1.8rem;
      font-weight: 600;
      letter-spacing: -0.5px;
    }

    .intro-text {
      text-align: left;
      margin-bottom: 2.5rem;
    }

    .intro-text p {
      margin-bottom: 0.75rem;
      font-size: 1rem;
      color: #cccccc;
      line-height: 1.6;
    }

    .intro-text a {
      color: #ffffff;
      text-decoration: none;
      border-bottom: 1px solid rgba(255, 255, 255, 0.3);
      padding-bottom: 2px;
      transition: all 0.3s ease;
      font-weight: 500;
    }

    .controls-container {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      gap: 1.5rem;
      margin-bottom: 2.5rem;
      padding: 1.25rem 1.5rem;
      background: #0a0a0a;
      border-radius: 20px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      backdrop-filter: blur(8px);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    }

    .controls-container label {
      color: #ffffff;
      font-weight: 500;
      font-size: 1rem;
      white-space: nowrap;
    }

    .custom-select {
      position: relative;
      display: inline-block;
      min-width: 220px;
    }

    .custom-select select {
      color-scheme: dark;
      appearance: none;
      -webkit-appearance: none;
      -moz-appearance: none;
      padding: 0.7rem 3rem 0.7rem 1.25rem;
      font-size: 0.95rem;
      border-radius: 12px;
      background: #111111;
      color: #ffffff;
      border: 1px solid rgba(255, 255, 255, 0.15);
      cursor: pointer;
      transition: all 0.25s ease;
      font-family: "Inter", system-ui;
      font-weight: 500;
      width: 100%;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }

    .custom-select select:hover {
      transform: translateY(-1px);
      border-color: rgba(255, 255, 255, 0.35);
      background: #151515;
    }

    .custom-select select:focus {
      outline: none;
      border-color: rgba(255, 255, 255, 0.6);
      box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
    }

    .custom-select::after {
      content: "▼";
      position: absolute;
      top: 50%;
      right: 1.2rem;
      transform: translateY(-50%) scaleY(0.7);
      color: #ffffff;
      font-size: 0.8rem;
      font-weight: 300;
      pointer-events: none;
    }

    .code-examples {
      display: flex;
      flex-direction: column;
      gap: 1.75rem;
    }

    pre[class*="language-"] {
      margin: 0;
      border-radius: 14px;
      overflow: auto;
      border: 1px solid rgba(255, 255, 255, 0.1);
      box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
      background: #0a0a0a;
      transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    pre[class*="language-"]:hover {
      transform: translateY(-2px);
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
    }

    code[class*="language-"] {
      font-family: "Fira Code", "Monaco", "Consolas", monospace;
      font-size: 0.9rem;
      line-height: 1.55;
    }

    .line-numbers .line-numbers-rows {
      border-right: 1px solid rgba(255, 255, 255, 0.15);
      padding-right: 0.8rem;
    }

    @media (max-width: 768px) {
      .blog-content {
        padding: 1rem 0.75rem 1rem 20px;
      }
      .page-header .tagline {
        font-size: 1.4rem;
      }
      .controls-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
        padding: 1rem 1.25rem;
      }
      .custom-select {
        min-width: 100%;
      }
      .controls-container label {
        white-space: normal;
      }
      .intro-text p {
        font-size: 0.95rem;
      }
      code[class*="language-"] {
        font-size: 0.8rem;
      }
    }

    ::-webkit-scrollbar {
      width: 8px;
      height: 8px;
    }
    ::-webkit-scrollbar-track {
      background: #0a0a0a;
    }
    ::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.25);
      border-radius: 8px;
    }

    .intro-text, .controls-container, .code-examples {
      animation: fadeSlideUp 0.5s ease-out forwards;
      opacity: 0;
    }
    .intro-text { animation-delay: 0.05s; }
    .controls-container { animation-delay: 0.12s; }
    .code-examples { animation-delay: 0.2s; }

    @keyframes fadeSlideUp {
      from {
        opacity: 0;
        transform: translateY(12px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    *:focus-visible {
      outline: 2px solid rgba(255, 255, 255, 0.5);
      outline-offset: 2px;
      border-radius: 4px;
    }
  </style>
</head>
<body>
  <main class="blog-content">
    <div class="intro-text">
      <p>✨ <strong>Prism.js live theming</strong> — switch syntax themes on the fly. Perfect for embedded iframes, documentation, or code showcases.</p>
      <p>Prism.js is a lightweight, extensible syntax highlighter. Use the dropdown to toggle between <strong>Default</strong>, <strong>Okaidia</strong>, <strong>Dark</strong>, and <strong>Line Numbers</strong> plugins.</p>
    </div>

    <div class="controls-container">
      <label for="bundle">🎨 Syntax theme</label>
      <div class="custom-select">
        <select id="bundle">
          <option value="default">🌿 Default</option>
          <option value="okaidia">🍃 Okaidia</option>
          <option value="dark">🌙 Dark</option>
          <option value="line-numbers">🔢 Default + Line Numbers</option>
        </select>
      </div>
    </div>

    <div class="code-examples">
      <!-- JavaScript snippet -->
      <pre><code class="language-js">
function calculateTotal(items, taxRate = 0.08) {
  const subtotal = items.reduce((sum, { price, quantity }) =>
    sum + (price * quantity), 0);
  const tax = subtotal * taxRate;
  return { subtotal, tax, total: subtotal + tax };
}

const cart = [
  { name: 'TypeScript Handbook', price: 29.99, quantity: 1 },
  { name: 'Mechanical Keyboard', price: 89.00, quantity: 1 },
  { name: 'USB-C Cable', price: 12.50, quantity: 2 }
];

const invoice = calculateTotal(cart);
console.table(invoice);
      </code></pre>

      <!-- CSS snippet -->
      <pre><code class="language-css">
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.75rem;
  padding: 1.5rem;
  background: radial-gradient(circle at 20% 30%, rgba(30,30,40,0.6), #0a0a0a);
}

.glass-card {
  background: rgba(20, 20, 30, 0.65);
  backdrop-filter: blur(12px);
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 1.5rem;
  transition: all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

.glass-card:hover {
  transform: translateY(-6px);
  border-color: rgba(255,255,255,0.25);
  box-shadow: 0 20px 32px -12px rgba(0,0,0,0.5);
}

@media (max-width: 640px) {
  .dashboard { gap: 1rem; padding: 1rem; }
  .glass-card { padding: 1.2rem; }
}
      </code></pre>

      <!-- HTML snippet -->
      <pre><code class="language-html">&lt;!-- Accessible component with micro-interactions --&gt;
&lt;div class="theme-preview"&gt;
  &lt;h3&gt;🎯 Code snippet gallery&lt;/h3&gt;
  &lt;div class="chip-container"&gt;
    &lt;span class="chip"&gt;prism.js&lt;/span&gt;
    &lt;span class="chip"&gt;themes&lt;/span&gt;
    &lt;span class="chip"&gt;iframe-friendly&lt;/span&gt;
  &lt;/div&gt;
  &lt;button class="copy-btn" aria-label="Copy code"&gt;
    &lt;svg width="18" height="18" viewBox="0 0 24 24" fill="none"&gt;
      &lt;path d="M16 1H4C2.9 1 2 1.9 2 3v14h2V3h12V1z" fill="currentColor"/&gt;
      &lt;path d="M20 5H8C6.9 5 6 5.9 6 7v14c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2z" fill="currentColor"/&gt;
    &lt;/svg&gt;
    Copy
  &lt;/button&gt;
&lt;/div&gt;</code></pre>
    </div>
  </main>

  <script>
    (function() {
      const PRISM_VERSION = "1.30.0";
      const head = document.head;

      const bundles = {
        default: {
          css: [`https://cdn.jsdelivr.net/npm/prismjs@${PRISM_VERSION}/themes/prism.css`],
          js: [`https://cdn.jsdelivr.net/npm/prismjs@${PRISM_VERSION}/prism.min.js`],
          preClass: ""
        },
        okaidia: {
          css: [`https://cdn.jsdelivr.net/npm/prismjs@${PRISM_VERSION}/themes/prism-okaidia.css`],
          js: [`https://cdn.jsdelivr.net/npm/prismjs@${PRISM_VERSION}/prism.min.js`],
          preClass: ""
        },
        dark: {
          css: [`https://cdn.jsdelivr.net/npm/prismjs@${PRISM_VERSION}/themes/prism-dark.css`],
          js: [`https://cdn.jsdelivr.net/npm/prismjs@${PRISM_VERSION}/prism.min.js`],
          preClass: ""
        },
        "line-numbers": {
          css: [
            `https://cdn.jsdelivr.net/npm/prismjs@${PRISM_VERSION}/themes/prism.css`,
            `https://cdn.jsdelivr.net/npm/prismjs@${PRISM_VERSION}/plugins/line-numbers/prism-line-numbers.css`
          ],
          js: [
            `https://cdn.jsdelivr.net/npm/prismjs@${PRISM_VERSION}/prism.min.js`,
            `https://cdn.jsdelivr.net/npm/prismjs@${PRISM_VERSION}/plugins/line-numbers/prism-line-numbers.min.js`
          ],
          preClass: "line-numbers"
        }
      };

      function appendScript(url) {
        const script = document.createElement("script");
        script.src = url;
        script.defer = true;
        script.setAttribute("data-prism", "");
        head.appendChild(script);
        return script;
      }

      function cleanupPrismAssets() {
        document.querySelectorAll("link[data-prism]").forEach(link => link.remove());
        document.querySelectorAll("script[data-prism]").forEach(script => script.remove());
      }

      function applyPreClass(className) {
        document.querySelectorAll("pre").forEach(pre => {
          pre.classList.remove("line-numbers");
          if (className === "line-numbers") pre.classList.add("line-numbers");
        });
      }

      function loadBundle(bundleId) {
        const bundle = bundles[bundleId];
        if (!bundle) return;

        cleanupPrismAssets();

        bundle.css.forEach(href => {
          const link = document.createElement("link");
          link.rel = "stylesheet";
          link.href = href;
          link.setAttribute("data-prism", "");
          head.appendChild(link);
        });

        const [coreJs, ...pluginJs] = bundle.js;
        const coreScript = appendScript(coreJs);

        coreScript.onload = () => {
          if (typeof Prism === "undefined") return;
          if (pluginJs.length === 0) {
            applyPreClass(bundle.preClass);
            Prism.highlightAll();
            return;
          }
          function loadPlugins(idx) {
            if (idx >= pluginJs.length) {
              applyPreClass(bundle.preClass);
              Prism.highlightAll();
              return;
            }
            const plugin = appendScript(pluginJs[idx]);
            plugin.onload = () => loadPlugins(idx + 1);
            plugin.onerror = () => loadPlugins(idx + 1);
          }
          loadPlugins(0);
        };
      }

      const selectEl = document.getElementById("bundle");
      if (selectEl) {
        selectEl.addEventListener("change", (e) => {
          loadBundle(e.target.value);
          e.target.style.transform = "scale(0.98)";
          setTimeout(() => { if (e.target) e.target.style.transform = ""; }, 130);
        });
      }

      loadBundle("default");

      window.addEventListener("load", () => {
        if (typeof Prism !== "undefined") Prism.highlightAll();
        document.querySelectorAll('.intro-text, .controls-container, .code-examples').forEach(el => {
          if (el.style.opacity === '0') el.style.opacity = '';
        });
      });
    })();
  </script>
</body>
</html>
MikeHiggins.me.uk LinkedIn GitHub Bluesky Contra Upwork
© 2026 Mike Higgins. All rights reserved.