Commit c0da41582b

Loris Cro <kappaloris@gmail.com>
2023-09-03 17:11:54
autodoc: better light mode colors
fix #15799
1 parent c3a8f1f
Changed files (2)
lib/docs/index.html
@@ -818,7 +818,8 @@
       pre {
         --zig-keyword: #333;
         --zig-builtin: #0086b3;
-        --zig-identifier: 'black';
+        --zig-identifier: black;
+        --zig-decl-identifier: #0086b3;
         --zig-string-literal: #d14;
         --zig-type: #458;
         --zig-fn: #900;
@@ -828,13 +829,13 @@
         pre {
           --zig-keyword: #eee;
           --zig-builtin: #ff894c;
-          --zig-identifier: 'purple';
+          --zig-identifier: #bbbbbb;
+          --zig-decl-identifier: lightblue;
           --zig-string-literal: #2e5;
           --zig-type: #68f;
           --zig-fn: #e33;
         }
       }
-    
 
     .zig_keyword_addrspace,
     .zig_keyword_align,
@@ -914,6 +915,11 @@
       color: var(--zig-identifier);
       font-weight: bold;
     }
+    
+    .zig_decl_identifier {
+      color: var(--zig-decl-identifier);
+      font-weight: bold;
+    }
 
     .zig_number_literal,
     .zig_special {
lib/docs/main.js
@@ -1269,12 +1269,14 @@ Happy writing!
       result = `<span class="zig_special">${src}</span>`;
     } else if (t.tag == Tag.identifier && t.fnDecl) {
       result = `<span class="zig_fn">${src}</span>`;
+    } else if (t.tag == Tag.identifier && t.isDecl) {
+      result = `<span class="zig_decl_identifier">${src}</span>`;
     } else {
       result = `<span class="zig_${t.tag}">${src}</span>`;
     }
 
     if (t.link) {
-      result = `<a href="${t.link}">` + result + "</a>";
+      result = `<a class="zighref="${t.link}">` + result + "</a>";
     }
 
     return result;
@@ -1316,9 +1318,9 @@ Happy writing!
         const name = getDecl(expr.declRef).name;
         const link = declLinkOrSrcLink(expr.declRef);
         if (link) {
-          yield { src: name, tag: Tag.identifier, link };
+          yield { src: name, tag: Tag.identifier, isDecl: true, link };
         } else {
-          yield { src: name, tag: Tag.identifier };
+          yield { src: name, tag: Tag.identifier, isDecl: true };
         }
         return;
       }