Skip to content

dracula/dracula-css

Repository files navigation

Dracula CSS

Framework-agnostic Dracula theme for the web β€” CSS variables, Sass, and JS tokens. Built and maintained by the community for people who use Dracula Themes. This is not an official Dracula team project.

Screenshot

πŸ§› What This Is (And What It Is Not)

Dracula CSS is not a component library. It is:

  • A design token system (colors, spacing, typography)
  • Base element styling (sensible defaults for HTML elements)
  • Framework-agnostic β€” works with React, Vue, Svelte, plain HTML, and other stacks

It focuses on shared color tokens and HTML defaults, not on a full component framework such as Bootstrap.

Why This Exists

Aspect dracula-ui (archived) Dracula CSS
Scope Full React component library Variables + base element styling only
Framework React-first Framework-agnostic β€” pure CSS/Sass
Dependencies React, TypeScript, TSDX Zero runtime deps
Maintenance High β€” components need updates Low β€” CSS variables are stable
Competition Competing with Tailwind, shadcn Not competing β€” complementary foundation
Use case "Build sites with Dracula UI" "Add Dracula colors to your existing stack"

Color Accuracy & Spec Compliance

Dracula CSS uses official Dracula specification colors β€” verified against spec.draculatheme.com.

Some third-party Dracula implementations use modified color values that differ from the official spec. Dracula CSS prioritizes spec compliance for consistency with the Dracula theme for Visual Studio Code, terminal themes, and other official implementations.

πŸ¦‡ Install

All instructions can be found at https://draculatheme.com/dracula-css.

Quick Start (CDN)

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dracula-css/dist/dracula.min.css" />

npm

npm install dracula-css
// Import from JavaScript or a CSS pipeline
import 'dracula-css/dist/dracula.css';

Sass

// Import variables only
@use 'dracula-css/src/scss/variables';

// Or import everything
@use 'dracula-css/src/scss/dracula';

CSS-in-JS

import { dracula, alucard } from 'dracula-css/dist/dracula-tokens.js';

// Use with styled-components, Emotion, or similar libraries
const styles = {
  backgroundColor: dracula.colors.bg,
  color: dracula.colors.fg,
};

⚰️ What's Included

File Use Case
dist/dracula.css Full bundle β€” variables + base styles
dist/dracula.min.css Minified production bundle
dist/dracula-variables.css Just CSS custom properties (no base styles)
dist/dracula-tokens.js JS/TS export for CSS-in-JS
src/scss/* Sass source files for customization

🩸 Color Architecture

Dracula CSS organizes colors from the official Dracula specification into three layers for web development:

Three Color Layers

1. Syntax Palette β€” For prose and content (bright, high contrast)

--drac-bg: #282a36;
--drac-fg: #f8f8f2;
--drac-purple: #bd93f9;
--drac-pink: #ff79c6;
/* ... and more */

2. UI Background Scale β€” For surfaces and elevation

--drac-ui-bg-darker: #191a21;
--drac-ui-bg-dark: #21222c;
--drac-ui-bg-light: #343746;
--drac-ui-bg-lighter: #424450;

3. Functional Colors β€” For UI interactions (buttons, alerts, validation)

--drac-ui-error: #de5735;
--drac-ui-warning: #a39514;
--drac-ui-success: #089108;
--drac-ui-info: #0081d6;
--drac-ui-focus: #815cd6;

Per the spec: "Functional colors are UI-specific colors for interactive elements, borders, and indicators. Do not use in editor or terminal applications."

πŸŒ™ Dark/Light Mode

Dracula CSS supports both dark (Dracula) and light (Alucard) modes:

<!-- Option 1: Automatic (follows system preference) -->
<html>
  ...
</html>

<!-- Option 2: Force dark mode -->
<html class="dracula-dark">
  ...
</html>

<!-- Option 3: Force light mode -->
<html class="dracula-light">
  ...
</html>

Base Element Styling

Includes sensible defaults for:

  • Typography: h1-h6, p, a, strong, em, small, mark, del, ins
  • Code: code, pre, kbd, samp, var
  • Lists: ul, ol, li, dl, dt, dd
  • Tables: table, th, td, caption (with striped rows)
  • Forms: input, textarea, select, button, label, fieldset
  • Other elements: blockquote, hr, details and summary, abbr

Not included (by design):

  • Layout utilities (flexbox helpers, grid systems)
  • Component classes (.card, .modal, .alert)
  • JavaScript behaviors
  • Complex animations

CSS Variables Reference

All variables are prefixed with --drac- to avoid conflicts:

/* Colors */
--drac-bg, --drac-fg, --drac-selection, --drac-comment
--drac-red, --drac-orange, --drac-yellow, --drac-green
--drac-purple, --drac-cyan, --drac-pink

/* UI Backgrounds */
--drac-ui-bg-darker, --drac-ui-bg-dark
--drac-ui-bg-light, --drac-ui-bg-lighter, --drac-ui-float

/* Functional */
--drac-ui-error, --drac-ui-warning, --drac-ui-success
--drac-ui-info, --drac-ui-focus

/* Semantic */
--drac-heading-color, --drac-link-color, --drac-link-hover-color
--drac-strong-color, --drac-emphasis-color, --drac-code-color

/* Typography */
--drac-font-family, --drac-font-family-mono
--drac-font-size-base, --drac-line-height

/* Spacing */
--drac-spacing-xs, --drac-spacing-sm, --drac-spacing-md
--drac-spacing-lg, --drac-spacing-xl

/* Borders */
--drac-border-radius, --drac-border-color

/* Transitions */
--drac-transition-duration, --drac-transition-timing

/* ANSI Colors (terminal emulators) */
--drac-ansi-black, --drac-ansi-red, --drac-ansi-green, --drac-ansi-yellow
--drac-ansi-blue, --drac-ansi-magenta, --drac-ansi-cyan, --drac-ansi-white
--drac-ansi-bright-black, --drac-ansi-bright-red, --drac-ansi-bright-green
--drac-ansi-bright-yellow, --drac-ansi-bright-blue, --drac-ansi-bright-magenta
--drac-ansi-bright-cyan, --drac-ansi-bright-white

🏰 Team

This theme is maintained by the following person(s) and a bunch of awesome contributors.

James Fishwick
James Fishwick

Community

  • Twitter - Best for getting updates about themes and new stuff.
  • GitHub - Best for asking questions and discussing issues.
  • Discord - Best for hanging out with the community.

Dracula PRO

Dracula PRO

License

MIT License

External Tools & Resources

Color Pickers & Generators:

Component libraries (third-party):

  • dracula-ui (archived) β€” React component library (uses modified colors, see "Color Accuracy" above)

Note: External tools may use modified Dracula color values that differ from the official spec. Dracula CSS uses spec-compliant colors for consistency with Visual Studio Code, terminal themes, and other official Dracula implementations.

Related

About

πŸ§›πŸ»β€β™‚οΈ Dark colours for CSS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors