Dark Mode & Theming

TableCrafter table builder, connect Gravity Forms, Google Sheets, Airtable, CSV, or JSON data sources
TableCrafter table builder, connect Gravity Forms, Google Sheets, Airtable, CSV, or JSON data sources

TableCrafter ships with automatic high-contrast and reduced-motion theming driven by OS preferences, plus a dark-aware loading skeleton. There is no full dark table theme out of the box, but every visual surface is a plain CSS class you can override to build one.

prefers-color-schemeCSS VariablesHigh ContrastReduced MotionClass Overrides

What TableCrafter does automatically

Theming in TableCrafter is preference-driven, not attribute-driven. When a table initializes, the script inspects the visitor's operating-system settings and applies matching classes to the table container. There is nothing to configure in the shortcode for this to work.

⚠️

Be honest about scope: prefers-color-scheme: dark only restyles the loading skeleton. The rendered table (headers, rows, badges, links, pagination) keeps its light palette in dark mode unless you add your own CSS. A full dark table is a theming task, covered below.

There is no theme or dark shortcode attribute

The [tablecrafter] shortcode has no color, theme, skin, or class attribute. Its real attributes are data and behavior oriented:

AttributePurposeRequired
sourceURL of the CSV / Google Sheet / JSON data source.Required
idCustom DOM id for the container (auto-generated if omitted).Optional
searchEnable the global search box.Optional
filtersEnable per-column filters.Optional
exportEnable the export toolbar.Optional
per_pageRows per page.Optional
sortInitial sort as column:direction.Optional

To theme a table you target it by its id (set one with the id attribute) or by the container class, then write CSS. The shortcode itself stays focused on data.

// Give the table a stable id you can target in CSS
[tablecrafter source="https://example.com/data.csv" id="pricing-table" search="true" export="true"]

The container classes you target

Two wrapper classes exist depending on how the table is rendered. Both are stable hooks for your CSS.

ClassWhere it appears
.tablecrafter-containerOuter server-rendered wrapper emitted by the shortcode (carries the id and all data-* config).
.tc-wrapperInner client-rendered wrapper; receives tc-high-contrast / tc-reduced-motion at runtime.

High-contrast theming via CSS variables

The one place TableCrafter exposes CSS custom properties is the high-contrast theme. When tc-high-contrast is active, four variables are defined on the wrapper and consumed across the table. These are the only theming variables in the plugin.

VariableDefaultApplies to
--tc-border-color#000000Table, header, and cell borders.
--tc-text-color#000000Header and cell text.
--tc-bg-color#ffffffHeader and cell background.
--tc-focus-color#ff0000Focus outline color for keyboard navigation.

Because these variables are scoped to .tc-high-contrast, you can redefine them in your theme to recolor the high-contrast experience without touching the plugin:

/* Recolor the high-contrast theme (only active when the OS
   reports prefers-contrast: high) */
.tc-wrapper.tc-high-contrast {
  --tc-border-color: #0a0a0a;
  --tc-text-color:   #0a0a0a;
  --tc-bg-color:     #ffffff;
  --tc-focus-color:  #0044cc;
}
ℹ️

High-contrast styles use !important so they override base colors reliably. If you want a high-contrast dark look, set --tc-bg-color to a dark value and --tc-text-color to a light one inside the .tc-high-contrast block.

Building a full dark table yourself

For a true dark theme across the whole table, wrap your overrides in @media (prefers-color-scheme: dark) and restyle the real classes. None of these are variables, so you set colors directly. The classes below are all present in the rendered markup:

ClassElement
.tc-table-containerScroll container with border and radius.
.tc-tableThe table element.
.tc-table thHeader cells (sticky).
.tc-table tdBody cells.
.tc-sortableSortable header cells.
.tc-linkAuto-rendered email/URL links.
.tc-badge / .tc-badge-success / .tc-badge-errorBoolean cell badges.
.tc-paginationPager controls.
@media (prefers-color-scheme: dark) {
  #pricing-table .tc-table-container {
    background: #1f2430;
    border-color: #374151;
  }
  #pricing-table .tc-table th {
    background-color: #2a3142;
    color: #e5e7eb;
  }
  #pricing-table .tc-table td {
    color: #d1d5db;
    border-bottom-color: #374151;
  }
  #pricing-table .tc-table tr:hover {
    background-color: #2a3142;
  }
  #pricing-table .tc-link { color: #60a5fa; }
}
💡

Scope dark rules to your table's id (here #pricing-table) so they don't bleed into other tables or your theme. Add the same overrides without the media query behind a manual class (e.g. a body class your theme's dark toggle sets) if you support a user-controlled dark switch instead of OS preference.

Reduced motion

When the OS requests reduced motion, TableCrafter adds tc-reduced-motion to the wrapper, which forces animation and transition durations to near-zero and disables smooth scrolling. This applies to the loading shimmer, sort transitions, and editable-cell highlights. You generally do not need to touch this, but you can extend it for custom animations you add:

.tc-wrapper.tc-reduced-motion .my-custom-anim {
  animation: none !important;
}

Where to add your CSS

Because there is no theme picker in the admin, theming is done with CSS. Add your overrides in any of these standard WordPress locations:

  1. Appearance → Customize → Additional CSS for quick, site-wide rules.
  2. Your child theme's style.css for version-controlled overrides.
  3. A small plugin or wp_enqueue_style snippet if you need the CSS to load alongside other functionality.

The TableCrafter admin screen itself lives under the TableCrafter top-level menu in wp-admin; it manages data sources and shortcodes, not colors.

ℹ️

The high-contrast and reduced-motion classes are toggled live: if a visitor changes their OS contrast or motion setting while the page is open, TableCrafter listens for the change and updates the table without a reload.

Summary

Next steps: see accessibility.html for the keyboard navigation and ARIA behavior that the high-contrast and reduced-motion themes build on, and shortcode-reference.html for the complete list of real [tablecrafter] attributes you can pair with your custom styling.