Skip to content

Commit cd10019

Browse files
committed
Fix dark mode
1 parent 5587819 commit cd10019

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

scripts/md2html/main.css

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,27 +73,58 @@ a.bibref {
7373
}
7474

7575
@media (prefers-color-scheme: dark) {
76-
pre,
77-
table tr:nth-child(2n),
78-
table tr {
76+
body.darkmode {
77+
--toclink-underline: #6a9000;
78+
--toclink-visited-underline: #fff;
79+
}
80+
81+
body.darkmode a,
82+
body.darkmode .tocxref,
83+
body.darkmode .u-url {
84+
color: #6a9000;
85+
}
86+
87+
body.darkmode code {
88+
color: #e66c33;
89+
}
90+
91+
body.darkmode:not(.toc-inline) #toc h2,
92+
body.darkmode h1,
93+
body.darkmode h2,
94+
body.darkmode h3,
95+
body.darkmode h4,
96+
body.darkmode h5,
97+
body.darkmode h6,
98+
body.darkmode #title,
99+
body.darkmode #subtitle,
100+
body.darkmode .toc-inline,
101+
body.darkmode .dt-published {
102+
color: #7bb01c;
103+
}
104+
105+
body.darkmode pre,
106+
body.darkmode table tr:nth-child(2n),
107+
body.darkmode table tr {
79108
background-color: #1e1e1e !important;
80109
color: #dcdcdc;
81110
}
82111

83-
img {
112+
body.darkmode img {
84113
background: transparent;
85114
}
86115

87-
.logo img {
116+
body.darkmode .logo img {
88117
display: none;
89118
}
90119

91-
.logo::before {
120+
body.darkmode .logo::before {
92121
content: "";
93122
display: inline-block;
94123
height: 48px;
95-
width: 200px;
96-
background: url("https://raw.githubusercontent.com/OAI/OpenAPI-Style-Guide/refs/heads/main/graphics/bitmap/OpenAPI_Logo_White.png") no-repeat center / contain;
124+
width: 175px;
125+
background: url("https://raw.githubusercontent.com/OAI/OpenAPI-Style-Guide/refs/heads/main/graphics/bitmap/OpenAPI_Logo_Pantone.png") no-repeat center / contain;
97126
vertical-align: middle;
98127
}
128+
}
129+
99130
}

scripts/md2html/md2html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ function preface(title,options) {
129129
preface += '<meta name="description" content="The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs.">';
130130

131131
// ReSpec
132+
preface += '<meta name="color-scheme" content="light dark">';
132133
preface += '<script src="../js/respec-w3c.js" class="remove"></script>';
133134
preface += `<script class="remove">var respecConfig = ${JSON.stringify(respec)};</script>`;
134135
try {
@@ -149,7 +150,6 @@ function preface(title,options) {
149150
preface += '<h2>Status of This Document</h2>';
150151
preface += 'The source-of-truth for this specification is the HTML file referenced above as <em>This version</em>.';
151152
preface += '</section>';
152-
preface += '<link rel="stylesheet" type="text/css" href="https://www.w3.org/StyleSheets/TR/2021/dark.css" media="(prefers-color-scheme: dark)">';
153153

154154
return preface;
155155
}

0 commit comments

Comments
 (0)