coverup

Install

Coverup is a stylesheet, a small script and an icon sprite. There is nothing to compile.

1. Add the files

Load them from a CDN, or copy the src/ folder into your project. Pin @main to a release tag in production.

<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700&display=swap">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/cksidharthan/coverup@main/src/coverup.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/cksidharthan/coverup@main/src/themes/all.css">  <!-- or just the themes you use -->
<script src="https://cdn.jsdelivr.net/gh/cksidharthan/coverup@main/src/coverup.js"></script>            <!-- in <head>, no defer -->

Put coverup.js in the head without defer. It applies the saved theme before the first paint, so there is no flash.

2. Mark the page

<html lang="en" data-theme="sky">   <!-- optional: sunny (default), sky, mint, lilac, tangerine -->
<body class="cu">

.cu sets the background, text color and font. Light or dark follows the visitor's system unless you set data-mode="light" or "dark".

3. Add htmx

<script src="https://unpkg.com/htmx.org@2.0.4"></script>

Coverup works without htmx, but with it you get styled confirms, server toasts, loading buttons and modals for free.

4. Icons

Components use an inline SVG sprite with a 1.5px line style. Paste src/icons.svg once near the top of <body>, then reference icons by id.

<svg class="i"><use href="#i-folder"/></svg>        <!-- 18px -->
<svg class="i i-sm"><use href="#i-trash"/></svg>      <!-- 15px -->

Include only the symbols you use, or add your own <symbol id="i-name">.

5. Tailwind (optional)

Coverup does not need Tailwind. If you use it, the preset maps utilities such as bg-accent, text-soft, border-rule and shadow-neo to the same tokens, so they follow the active theme and mode.

// tailwind.config.js
module.exports = { presets: [require('coverup-ui/tailwind.preset')] };

A complete page

<!doctype html>
<html lang="en" data-theme="sky">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>My app</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/cksidharthan/coverup@main/src/coverup.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/cksidharthan/coverup@main/src/themes/sky.css">
  <script src="https://cdn.jsdelivr.net/gh/cksidharthan/coverup@main/src/coverup.js"></script>
  <script src="https://unpkg.com/htmx.org@2.0.4" defer></script>
</head>
<body class="cu">
  <header class="topbar">
    <span class="logo">c</span>
    <strong>My app</strong>
  </header>
  <main style="padding:24px">
    <button class="btn btn-primary" hx-post="/save">Save</button>
  </main>
</body>
</html>

Pick a themeBrowse components