Skip to content

Commit 5ed12c4

Browse files
committed
simplify CSS, light/dark switch on auto, fix RST tables to be html
1 parent 5a6b4fc commit 5ed12c4

14 files changed

+1455
-3730
lines changed

api-docs/cppdocs/Doxyfile-HTML

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ MARKDOWN_SUPPORT = NO
334334
# Minimum value: 0, maximum value: 99, default value: 5.
335335
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
336336

337-
TOC_INCLUDE_HEADINGS = 5
337+
TOC_INCLUDE_HEADINGS = 0
338338

339339
# When enabled doxygen tries to link words that correspond to documented
340340
# classes, or namespaces to their corresponding documentation. Such a link can
@@ -1053,7 +1053,7 @@ REFERENCES_LINK_SOURCE = NO
10531053
# The default value is: YES.
10541054
# This tag requires that the tag SOURCE_BROWSER is set to YES.
10551055

1056-
SOURCE_TOOLTIPS = YES
1056+
SOURCE_TOOLTIPS = NO
10571057

10581058
# If the USE_HTAGS tag is set to YES then the references to source code will
10591059
# point to the HTML generated by the htags(1) tool instead of doxygen built-in
@@ -1175,7 +1175,7 @@ HTML_FOOTER = footer.html
11751175
# obsolete.
11761176
# This tag requires that the tag GENERATE_HTML is set to YES.
11771177

1178-
HTML_STYLESHEET =
1178+
HTML_STYLESHEET = binaryninja-docs.css
11791179

11801180
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
11811181
# cascading style sheets that are included after the standard style sheets
@@ -1188,10 +1188,7 @@ HTML_STYLESHEET =
11881188
# list). For an example see the documentation.
11891189
# This tag requires that the tag GENERATE_HTML is set to YES.
11901190

1191-
HTML_EXTRA_STYLESHEET = doxygen-awesome-css/doxygen-awesome.css \
1192-
doxygen-awesome-css/doxygen-awesome-sidebar-only.css \
1193-
doxygen-awesome-css/doxygen-awesome-sidebar-only-darkmode-toggle.css \
1194-
custom.css
1191+
HTML_EXTRA_STYLESHEET =
11951192

11961193
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
11971194
# other source files which should be copied to the HTML output directory. Note
@@ -1201,7 +1198,7 @@ HTML_EXTRA_STYLESHEET = doxygen-awesome-css/doxygen-awesome.css \
12011198
# files will be copied as-is; there are no commands or markers available.
12021199
# This tag requires that the tag GENERATE_HTML is set to YES.
12031200

1204-
HTML_EXTRA_FILES = doxygen-awesome-css/doxygen-awesome-darkmode-toggle.js
1201+
HTML_EXTRA_FILES = binaryninja-darkmode.js
12051202

12061203
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
12071204
# will adjust the colors in the style sheet and background images according to
@@ -1251,15 +1248,15 @@ HTML_TIMESTAMP = NO
12511248
# The default value is: YES.
12521249
# This tag requires that the tag GENERATE_HTML is set to YES.
12531250

1254-
HTML_DYNAMIC_MENUS = NO
1251+
HTML_DYNAMIC_MENUS = YES
12551252

12561253
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
12571254
# documentation will contain sections that can be hidden and shown after the
12581255
# page has loaded.
12591256
# The default value is: NO.
12601257
# This tag requires that the tag GENERATE_HTML is set to YES.
12611258

1262-
HTML_DYNAMIC_SECTIONS = NO
1259+
HTML_DYNAMIC_SECTIONS = YES
12631260

12641261
# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
12651262
# shown in the various tree structured indices initially; the user can expand
@@ -1490,6 +1487,9 @@ DISABLE_INDEX = YES
14901487

14911488
GENERATE_TREEVIEW = YES
14921489

1490+
# Disable the page outline panel on the right side
1491+
PAGE_OUTLINE_PANEL = NO
1492+
14931493
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
14941494
# doxygen will group on one line in the generated HTML documentation.
14951495
#
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/**
2+
* Binary Ninja Dark Mode - System Preference with Cookie Persistence
3+
* Follows system color scheme automatically via CSS
4+
* Provides console toggle for testing with cookie-based persistence
5+
*/
6+
7+
(function() {
8+
'use strict';
9+
10+
const COOKIE_NAME = 'bn-docs-theme';
11+
const COOKIE_DAYS = 365;
12+
13+
/**
14+
* Get cookie value by name
15+
*/
16+
function getCookie(name) {
17+
const value = `; ${document.cookie}`;
18+
const parts = value.split(`; ${name}=`);
19+
if (parts.length === 2) return parts.pop().split(';').shift();
20+
return null;
21+
}
22+
23+
/**
24+
* Set cookie value
25+
*/
26+
function setCookie(name, value, days) {
27+
const date = new Date();
28+
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
29+
const expires = `expires=${date.toUTCString()}`;
30+
document.cookie = `${name}=${value};${expires};path=/`;
31+
}
32+
33+
/**
34+
* Delete cookie
35+
*/
36+
function deleteCookie(name) {
37+
document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/`;
38+
}
39+
40+
/**
41+
* Apply theme mode
42+
*/
43+
function applyTheme(mode) {
44+
const html = document.documentElement;
45+
46+
if (mode === 'dark') {
47+
html.classList.remove('light-mode');
48+
html.classList.add('dark-mode');
49+
} else if (mode === 'light') {
50+
html.classList.remove('dark-mode');
51+
html.classList.add('light-mode');
52+
} else {
53+
// Auto mode - remove both classes to follow system preference
54+
html.classList.remove('dark-mode');
55+
html.classList.remove('light-mode');
56+
}
57+
}
58+
59+
/**
60+
* Console-accessible toggle function with cookie persistence
61+
* Usage: bnToggleDarkMode('dark'), bnToggleDarkMode('light'), or bnToggleDarkMode('auto')
62+
*/
63+
window.bnToggleDarkMode = function(mode) {
64+
if (mode === 'dark') {
65+
applyTheme('dark');
66+
setCookie(COOKIE_NAME, 'dark', COOKIE_DAYS);
67+
console.log('Dark mode: FORCED ON (saved to cookie, will persist across reloads)');
68+
} else if (mode === 'light') {
69+
applyTheme('light');
70+
setCookie(COOKIE_NAME, 'light', COOKIE_DAYS);
71+
console.log('Dark mode: FORCED OFF (saved to cookie, will persist across reloads)');
72+
} else if (mode === 'auto') {
73+
applyTheme('auto');
74+
deleteCookie(COOKIE_NAME);
75+
console.log('Dark mode: AUTO (following system preference, cookie cleared)');
76+
} else {
77+
console.log('Usage: bnToggleDarkMode("dark"), bnToggleDarkMode("light"), or bnToggleDarkMode("auto")');
78+
console.log('Current setting:', getCookie(COOKIE_NAME) || 'auto (system preference)');
79+
}
80+
};
81+
82+
/**
83+
* Initialize theme on page load
84+
*/
85+
function init() {
86+
const savedTheme = getCookie(COOKIE_NAME);
87+
88+
if (savedTheme) {
89+
applyTheme(savedTheme);
90+
console.log(`Binary Ninja Docs: Theme loaded from cookie: ${savedTheme}`);
91+
} else {
92+
console.log('Binary Ninja Docs: Following system preference (no cookie set)');
93+
}
94+
95+
console.log('Use bnToggleDarkMode("dark"), bnToggleDarkMode("light"), or bnToggleDarkMode("auto") to change theme');
96+
}
97+
98+
// Initialize on page load
99+
init();
100+
})();

0 commit comments

Comments
 (0)