RapiDocv11.0
Overhauled Theming Architecture

Themes, Brand Colors & Typography

RapiDoc features a streamlined, token-driven styling architecture inspired by modern design systems. Configure rich color presets, custom brand hex colors, contrast modes, typography, and corner radius using clean declarative attributes.

9Built-in Presets
#HEXAny Brand Color
3Color Modes (Dark / Light / System)
5Radius Scales
Streamlined Interface

The Four Primary Styling Attributes

Instead of dozens of disparate color properties, RapiDoc consolidates visual styling into four high-leverage attributes:theme, color-scheme, radius, and scale.

Quickstart Blueprint

Instant Declarative Theming

Configure complete visual styling directly in your HTML tag with zero CSS boilerplate or build steps required.

POSTREQUESTRESPONSE
Interactive ControlsLive Reactive
index.html
AttributeType / AllowedDefaultDescription & Behavior
theme
preset | #hex
amber, blue, graphite, modern, emerald, violet, rose, slate, default, or #hex
amberSets the primary brand color palette. Accepts any built-in shadcn/ui-inspired preset or a custom brand color hex code (e.g. #2563eb).
color-scheme
string
dark | light | system
darkControls dark or light surface mode. When set to "system", RapiDoc automatically switches based on the user OS prefers-color-scheme setting.
radius
string
none | sm | md | lg | full
smCorner radius scale applied to cards, buttons, badges, parameter inputs, and dialogs (--radius and --card-radius).
scale
string
sm | default | lg
defaultProportionally scales UI base dimensions, body fonts, monospace code blocks, and sidebar width across the documentation.
nav-item-spacing
string
compact | default | relaxed
defaultControls vertical density and padding of sidebar navigation links independently of typography scale.
load-fonts
boolean
true | false
trueAutomatically loads default Open Sans from Google Fonts CDN. Set to "false" in air-gapped, offline, or enterprise intranet environments.
render-style
string
focused | read | view
focusedDocument presentation layout mode: single-operation focused console, continuous reading doc, or multi-column interactive view.
schema-style
string
tree | table
treeVisual formatting of request and response payload schemas (interactive collapsible tree or structured property table).
Color Palettes

Built-in Presets & Custom Hex Brand Colors

Choose from curated presets matched to modern design systems, or pass any corporate brand hex color directly into theme.

Amber
DEFAULT

Warm amber accents over dark charcoal surfaces. High visibility and modern developer aesthetic.

Blue

Classic vivid blue brand accent with balanced neutral dark backgrounds. Highly readable for technical portals.

Emerald

Vibrant emerald green accents over deep navy slate surfaces. Ideal for payments, banking, and crypto APIs.

Violet

Electric purple highlights paired with subtle deep violet surface tints for modern SaaS and developer ecosystems.

Graphite
Monochrome

Ultra-clean monochrome palette inspired by high-contrast developer tools and modern terminal UI designs.

Rose

Vibrant rose pink highlights over neutral slate surfaces. High contrast and contemporary visual polish.

Slate

Sophisticated cool grey slate accents for understated enterprise corporate documentation portals.

Custom Brand Color

Hex Color Dynamic Contrast Engine

Pass your corporate brand color (such as #2563eb or #ff5722) directly to theme. RapiDoc automatically calculates perceived YIQ luminance, assigns the focus ring and primary token, and guarantees accessible contrast on button text by dynamically selecting pure black or crisp white.

custom-brand.html
<!-- Use your corporate brand hex color directly -->
<rapi-doc
  spec-url="https://api.acme.corp/openapi.json"
  theme="#2563eb"
  color-scheme="dark"
  radius="lg"
  scale="default"
></rapi-doc>

<!--
  RapiDoc automatically analyzes #2563eb luminance:
  - Generates --primary: #2563eb
  - Generates --ring: #2563eb
  - Generates high-contrast --primary-foreground: #ffffff
-->
Layout & Geometry

Corner Radius & Sizing Scale

Calibrate corner roundness and base density to match your product's UI design language.

Corner Radius (radius)

Controls roundness across cards, buttons, badges, parameter inputs, and dialogs:

  • radius="none"0px sharp geometric corners
  • radius="sm"4px (0.25rem) — Default sleek modern
  • radius="md"6px (0.375rem) balanced roundness
  • radius="lg"8px (0.5rem) pronounced roundness
  • radius="full"Pill buttons/inputs (9999px), 8px cards

UI Scale (scale)

Harmoniously scales base sizing, font dimensions, and sidebar width:

  • scale="sm"Compact (13px base, 17rem nav)
    Ideal for embedded widgets and compact consoles
  • scale="default"Standard (14px base, 18.75rem nav)
    Standard desktop layout for public developer hubs
  • scale="lg"Generous (16px base, 21rem nav)
    Enhanced readability, high-DPI displays, and presentations
Typography Tokens

Custom Typography & Google Fonts Pairing

RapiDoc natively supports shadcn/ui design tokens. Set --font-sans (or --font-regular) and --font-mono on <rapi-doc> to seamlessly apply any custom font family.

Typography Recipe

Pairing Inter & JetBrains Mono

Load your Google Fonts stylesheet in the document head and bind the tokens directly in CSS. Set load-fonts="false" to prevent RapiDoc from fetching the default Open Sans font.

typography.html
<!-- Load custom Google Fonts in document head -->
<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@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">

<style>
  /* Override typography tokens directly on <rapi-doc> */
  rapi-doc {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  }
</style>

<rapi-doc
  spec-url="https://petstore.swagger.io/v2/swagger.json"
  theme="violet"
  color-scheme="dark"
  radius="md"
  load-fonts="false"
></rapi-doc>
Programmatic Control

Dynamic Runtime Theming via JavaScript

Because RapiDoc is a standard custom HTML element, its styling attributes reflect instantly when modified through vanilla DOM methods.

theme-controller.js
// Select the RapiDoc custom element in the DOM
const doc = document.querySelector('rapi-doc');

// Switch theme preset or brand color
function setBrandTheme(presetOrHex) {
  doc.setAttribute('theme', presetOrHex); // e.g. 'emerald', 'violet', or '#ff5722'
}

// Toggle between dark and light modes
function toggleColorScheme() {
  const current = doc.getAttribute('color-scheme') || 'dark';
  doc.setAttribute('color-scheme', current === 'dark' ? 'light' : 'dark');
}

// Adjust corner roundness dynamically
function setRadius(size) {
  doc.setAttribute('radius', size); // 'none', 'sm', 'md', 'lg', 'full'
}

// Switch UI scaling dynamically
function setScale(size) {
  doc.setAttribute('scale', size); // 'sm', 'default', 'lg'
}

Need Granular CSS Customization?

For custom frosted glass navigation, gradient badges, Shadow DOM piercing, and complete parts catalogs, explore our Custom CSS & Shadow Parts Guide.

Explore Custom CSS & Shadow Parts Guide