Skip to content

Commit 96b2b93

Browse files
gmarullcarlescufi
authored andcommitted
doc: doxygen: adjust Doxygen theme to match Sphinx better
Adjust the Doxygen theme (based on doxygen-awesome) to match the Sphinx theme. While not perfect, the experience should now be more consistent. Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent 194aa43 commit 96b2b93

File tree

6 files changed

+275
-9
lines changed

6 files changed

+275
-9
lines changed

doc/_doxygen/doxygen-awesome-zephyr.css

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ html {
2020

2121
--link-color: #2980b9;
2222
--param-color: #b71c1c;
23+
24+
--side-nav-fixed-width: 300px;
25+
--top-height: 220px;
2326
}
2427

2528
@media (prefers-color-scheme: dark) {
@@ -54,12 +57,6 @@ html.dark-mode {
5457
--param-color: #ef9a9a;
5558
}
5659

57-
@media screen and (min-width: 767px) {
58-
#projectname, #projectbrief, #projectnumber {
59-
color: var(--side-nav-foreground);
60-
}
61-
}
62-
6360
a:link, a:visited, a:hover, a:focus, a:active {
6461
color: var(--link-color) !important;
6562
}
@@ -71,3 +68,40 @@ a:link, a:visited, a:hover, a:focus, a:active {
7168
dl.section dd, dl.bug dd, dl.deprecated dd {
7269
margin-inline-start: revert;
7370
}
71+
72+
/* adjust top and title to ~match Sphinx docs */
73+
#top {
74+
background: var(--side-nav-background);
75+
}
76+
77+
#titlearea {
78+
padding-bottom: 0;
79+
}
80+
81+
#titlearea table {
82+
width: 100%;
83+
}
84+
85+
#projectlogo img {
86+
width: 200px;
87+
height: 95px;
88+
max-height: none !important;
89+
padding-top: 12px;
90+
}
91+
92+
#projectalign {
93+
display: none;
94+
}
95+
96+
@media screen and (min-width: 767px) {
97+
#doc-content {
98+
padding-top: calc(var(--top-height) - 180px);
99+
}
100+
}
101+
102+
/* style for re-injected version */
103+
#projectversion {
104+
color: var(--side-nav-foreground);
105+
padding-top: 25px;
106+
text-align: center;
107+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
window.addEventListener('DOMContentLoaded', (event) => {
7+
/* re-inject project version at a custom location */
8+
let version = document.getElementById('projectnumber').innerText
9+
let titleTable = document.querySelector('#titlearea table');
10+
let cell = titleTable.insertRow(1).insertCell(0);
11+
cell.innerHTML = '<div id="projectversion">' + version + '</div>';
12+
});

doc/_doxygen/header.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<script type="text/javascript" src="$relpath^jquery.js"></script>
1313
<script type="text/javascript" src="$relpath^dynsections.js"></script>
1414
<script type="text/javascript" src="$relpath^doxygen-awesome-darkmode-toggle.js"></script>
15+
<script type="text/javascript" src="$relpath^doxygen-awesome-zephyr.js"></script>
1516
$treeview
1617
$search
1718
$mathjax

doc/_doxygen/logo.png

-4.67 KB
Binary file not shown.

doc/_doxygen/logo.svg

Lines changed: 218 additions & 0 deletions
Loading

doc/zephyr.doxyfile.in

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ PROJECT_BRIEF = "A Scalable Open Source RTOS"
5151
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
5252
# the logo to the output directory.
5353

54-
PROJECT_LOGO = @ZEPHYR_BASE@/doc/_doxygen/logo.png
54+
PROJECT_LOGO = @ZEPHYR_BASE@/doc/_doxygen/logo.svg
5555

5656
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
5757
# into which the generated documentation will be written. If a relative path is
@@ -1278,7 +1278,8 @@ HTML_EXTRA_STYLESHEET = @ZEPHYR_BASE@/doc/_doxygen/doxygen-awesome.css \
12781278
# files will be copied as-is; there are no commands or markers available.
12791279
# This tag requires that the tag GENERATE_HTML is set to YES.
12801280

1281-
HTML_EXTRA_FILES = @ZEPHYR_BASE@/doc/_doxygen/doxygen-awesome-darkmode-toggle.js
1281+
HTML_EXTRA_FILES = @ZEPHYR_BASE@/doc/_doxygen/doxygen-awesome-darkmode-toggle.js \
1282+
@ZEPHYR_BASE@/doc/_doxygen/doxygen-awesome-zephyr.js
12821283

12831284
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
12841285
# will adjust the colors in the style sheet and background images according to
@@ -1600,7 +1601,7 @@ ENUM_VALUES_PER_LINE = 4
16001601
# Minimum value: 0, maximum value: 1500, default value: 250.
16011602
# This tag requires that the tag GENERATE_HTML is set to YES.
16021603

1603-
TREEVIEW_WIDTH = 250
1604+
TREEVIEW_WIDTH = 300
16041605

16051606
# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
16061607
# external symbols imported via tag files in a separate window.

0 commit comments

Comments
 (0)