Skip to content

Commit 94438f0

Browse files
committed
Fix the logo display
1 parent 4349021 commit 94438f0

2 files changed

Lines changed: 34 additions & 5 deletions

File tree

book/src/intro.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
<div class="license-notice">
22
<p><em>Materials in this book are distributed under the terms of <a href="https://github.com/ehsanmok/create-your-own-lang-with-rust/blob/master/LICENSE">Creative Commons BY-NC-SA 4.0</a></em></p>
33
<img alt="license" src="./img/by-nc-sa.png">
4-
<picture>
5-
<source media="(prefers-color-scheme: dark)" srcset="./img/logo_dark_mode.png">
6-
<source media="(prefers-color-scheme: light)" srcset="./img/logo_light_mode.png">
7-
<img src="./img/logo_dark_mode.png" alt="CreateLang.rs Logo" class="logo-img" width="320">
8-
</picture>
4+
<img src="./img/logo_light_mode.png" alt="CreateLang.rs Logo" class="logo-img logo-light" width="320">
5+
<img src="./img/logo_dark_mode.png" alt="CreateLang.rs Logo" class="logo-img logo-dark" width="320">
96
</div>
107

118
---

book/theme/custom.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,38 @@ blockquote p {
383383
height: auto;
384384
}
385385

386+
/* =============================================================================
387+
LOGO THEME SWITCHING
388+
Show correct logo based on mdbook theme, not OS prefers-color-scheme
389+
============================================================================= */
390+
391+
.license-notice .logo-img {
392+
max-width: 320px;
393+
height: auto;
394+
}
395+
396+
/* Default: show light mode logo (for Rust theme - light background) */
397+
.license-notice .logo-light {
398+
display: block;
399+
}
400+
401+
.license-notice .logo-dark {
402+
display: none;
403+
}
404+
405+
/* Dark themes: show dark mode logo (light text for dark backgrounds) */
406+
.coal .license-notice .logo-light,
407+
.navy .license-notice .logo-light,
408+
.ayu .license-notice .logo-light {
409+
display: none;
410+
}
411+
412+
.coal .license-notice .logo-dark,
413+
.navy .license-notice .logo-dark,
414+
.ayu .license-notice .logo-dark {
415+
display: block;
416+
}
417+
386418
/* =============================================================================
387419
LINKS
388420
============================================================================= */

0 commit comments

Comments
 (0)