]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
man/custom-html: support dark mode
authorDaniel Foster <daniel@amesite.me>
Sun, 25 Jan 2026 05:14:11 +0000 (15:14 +1000)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 27 Jan 2026 12:43:33 +0000 (13:43 +0100)
Use the browser's default style and opt in for dark mode.

Has the bonus of removing some
[deprecated attributes](https://developer.mozilla.org/docs/Web/HTML/Reference/Elements/body#deprecated_attributes).

man/custom-html.xsl

index 45cd1f922d639787bde2d169226e2456ac9d259d..39f490e5f839046ba6dff56fe54850a1e16412ff 100644 (file)
 <!-- add Index link at top of page -->
 <xsl:template name="user.header.content">
   <style>
+    :root {
+      color-scheme: light dark;
+    }
+
     a.headerlink {
       color: #c60f0f;
       font-size: 0.8em;
   <xsl:text>"</xsl:text>
 </xsl:template>
 
+<!-- copied from docbook to remove the static color declarations -->
+<xsl:template name="body.attributes">
+  <xsl:if test="starts-with($writing.mode, 'rl')">
+    <xsl:attribute name="dir">rtl</xsl:attribute>
+  </xsl:if>
+</xsl:template>
+
 <!-- Switch things to UTF-8, ISO-8859-1 is soo yesteryear -->
 <xsl:output method="html" encoding="UTF-8" indent="no"/>