-
-
Notifications
You must be signed in to change notification settings - Fork 421
dark mode
Marcos Caceres edited this page Mar 27, 2026
·
3 revisions
ReSpec supports dark mode for W3C specs via the standard color-scheme meta tag.
<head>
<meta name="color-scheme" content="light dark">
</head>This uses the official W3C dark stylesheet from tr-design and respects the user's prefers-color-scheme preference.
The ReSpec pill includes a dark mode toggle that overrides the system preference. This toggle injects a .darkmode class on <body> via JavaScript.
Because the manual toggle uses a JavaScript-injected class rather than a CSS media query, custom CSS must target both approaches:
/* System preference */
@media (prefers-color-scheme: dark) {
.my-custom-element { background: #1a1a1a; }
}
/* ReSpec manual toggle */
body.darkmode .my-custom-element { background: #1a1a1a; }- Dark mode styles are part of the W3C TR design system — only available for W3C specs
- The
.darkmodeclass limitation is a known architectural issue; the CSSprefers-color-schememedia query does not respond to JS-injected class names - For specs with heavy custom CSS, you will need to duplicate your dark-mode rules to cover both the media query and the
.darkmodeclass
💖 Support ReSpec by becoming a sponsor via Open Collective. 💖
✨ View rendered version of this documentation at https://respec.org/docs/ ✨
- Getting Started
- How Do I…
- Spec Editor's Guide
- Writing Algorithms
- WebIDL Guide
- Configuring ReSpec
- Developers Guide
- Shorthands
- addSectionLinks
- authors
- caniuse
- edDraftURI
- editors
- format (markdown)
- formerEditors
- github
- highlightVars
- isPreview
- license
- lint
- localBiblio
- logos
- maxTocLevel
- mdn
- modificationDate
- monetization
- noTOC
- otherLinks
- pluralize
- postProcess
- preProcess
- previousDiffURI
- previousMaturity
- previousPublishDate
- prevRecShortname
- prevRecURI
-
processVersion(Removed) - publishDate
- shortName
- specStatus
- subjectPrefix
- subtitle
- testSuiteURI
- xref
- additionalCopyrightHolders
-
addPatentNote(Removed) - alternateFormats
- canonicalURI
- charterDisclosureURI
- copyrightStart
- crEnd
- dark mode
- doJsonLd
- errata
- group
- implementationReportURI
- level
- noRecTrack
- prevED
- prEnd
- submissionCommentNumber
-
wg(Deprecated — usegroup) -
wgId(Deprecated — usegroup) -
wgPatentURI(Deprecated — usegroup) -
wgPublicList(Deprecated — usegroup) -
wgURI(Deprecated — usegroup)
a11ycheck-charsetcheck-internal-slotscheck-punctuationinformative-dfnlocal-refs-existno-captionless-tablesno-headingless-sectionsno-http-propsno-link-warningsno-unused-dfnsno-unused-varsprivsec-sectionwpt-tests-exist
Handled by ReSpec for you.
- conformance
- idl-index
- index
- issue-summary
- references
- tof (Table of Figures)
- data-abbr
- data-cite
- data-dfn-for
- data-dfn-type
- data-export
- data-format
- data-include
- data-include-format
- data-include-replace
- data-link-for
- data-link-type
- data-local-lt
- data-lt
- data-lt-no-plural
- data-lt-noDefault
- data-max-toc
- data-number
- data-oninclude
- data-sort
- data-tests
-
data-transform(Deprecated) - data-type
- dir
- lang