Skip to content

Commit 8d11532

Browse files
committed
maybe fix darkmode problems
1 parent e790cb4 commit 8d11532

12 files changed

+1706
-2292
lines changed

docs/src/assets/edgemodel-dark.svg

Lines changed: 281 additions & 0 deletions
Loading

docs/src/assets/edgemodel.svg

Lines changed: 280 additions & 1245 deletions
Loading

docs/src/assets/edgemodel.tex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
% >=stealth',
77
% }
88
\usepackage{amsmath,amssymb}
9-
\usepackage{tikz}
10-
\usepackage{xcolor}
9+
\usepackage{ndtheme}
1110

1211
\begin{document}
13-
\begin{tikzpicture}
12+
\begin{tikzpicture}[\ndtheme]
1413
\node[draw, minimum height=1.5cm](n){
1514
Edge Model
1615
};

docs/src/assets/makelatexfigs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,23 @@ if ! command_exists pdf2svg; then
1717
exit 1
1818
fi
1919

20-
latexmk -pdflua -shell-escape mathmodel.tex
21-
latexmk -pdflua -shell-escape edgemodel.tex
22-
latexmk -pdflua -shell-escape nodemodel.tex
20+
# List of figures to generate
21+
figures=(mathmodel edgemodel nodemodel)
22+
23+
# Generate light versions (default)
24+
echo "Generating light versions..."
25+
for fig in "${figures[@]}"; do
26+
latexmk -pdflua -shell-escape "${fig}.tex"
27+
done
28+
29+
# Generate dark versions
30+
echo "Generating dark versions..."
31+
for fig in "${figures[@]}"; do
32+
cp "${fig}.tex" "${fig}-dark.tex"
33+
NDTHEME=dark latexmk -pdflua -shell-escape "${fig}-dark.tex"
34+
rm "${fig}-dark.tex"
35+
done
36+
2337
latexmk -C
38+
# Clean up remaining temp files that latexmk -C might miss
39+
rm -f *.aux *.fdb_latexmk *.fls *.log *.pdf

docs/src/assets/mathmodel-dark.svg

Lines changed: 545 additions & 0 deletions
Loading

docs/src/assets/mathmodel.svg

Lines changed: 35 additions & 33 deletions
Loading

docs/src/assets/mathmodel.tex

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,10 @@
66
% >=stealth',
77
% }
88
\usepackage{amsmath,amssymb}
9-
\usepackage{tikz}
10-
\usepackage{xcolor}
11-
\makeatletter
12-
\def\mathcolor#1#{\@mathcolor{#1}}
13-
\def\@mathcolor#1#2#3{%
14-
\protect\leavevmode
15-
\begingroup
16-
\color#1{#2}#3%
17-
\endgroup
18-
}
19-
\makeatother
20-
\definecolor{wblue}{HTML}{0072b2}
21-
\definecolor{worange}{HTML}{e69f00}
22-
\definecolor{wbblue}{HTML}{56b4e9}
23-
\definecolor{wgreen}{HTML}{009e73}
24-
\definecolor{wyellow}{HTML}{f0e442}
9+
\usepackage{ndtheme}
10+
2511
\begin{document}
26-
\pagecolor{white}
27-
\begin{tikzpicture}
12+
\begin{tikzpicture}[\ndtheme]
2813
\node[draw, circle](n1){1};
2914
\node[draw, circle] at (10cm, 1cm)(n2){2};
3015
\node[draw, circle] at (2.5cm, -1.5cm)(n3){3};

docs/src/assets/ndtheme.sty

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
% ndtheme.sty - NetworkDynamics figure theming
2+
\NeedsTeXFormat{LaTeX2e}
3+
\ProvidesPackage{ndtheme}[2024/01/01 NetworkDynamics figure themes]
4+
5+
\RequirePackage{xcolor}
6+
\RequirePackage{tikz}
7+
\usetikzlibrary{backgrounds}
8+
9+
% Define NetworkDynamics colors (keeping existing palette)
10+
\definecolor{wblue}{HTML}{0072b2}
11+
\definecolor{worange}{HTML}{e69f00}
12+
\definecolor{wbblue}{HTML}{56b4e9}
13+
\definecolor{wgreen}{HTML}{009e73}
14+
\definecolor{wyellow}{HTML}{f0e442}
15+
16+
% Light theme colors
17+
\definecolor{ndlight-text}{HTML}{000000}
18+
\definecolor{ndlight-line}{HTML}{000000}
19+
\definecolor{ndlight-bg}{HTML}{ffffff}
20+
21+
% Dark theme colors
22+
\definecolor{nddark-text}{HTML}{ffffff}
23+
\definecolor{nddark-line}{HTML}{ffffff}
24+
\definecolor{nddark-bg}{HTML}{000000}
25+
26+
% Theme styles
27+
\tikzset{
28+
ndlight/.style={
29+
text=ndlight-text,
30+
draw=ndlight-line,
31+
every node/.append style={text=ndlight-text},
32+
every path/.append style={draw=ndlight-line}
33+
},
34+
nddark/.style={
35+
text=nddark-text,
36+
draw=nddark-line,
37+
every node/.append style={text=nddark-text},
38+
every path/.append style={draw=nddark-line}
39+
}
40+
}
41+
42+
% Set theme based on environment variable
43+
\directlua{
44+
if os.getenv("NDTHEME") == "dark" then
45+
tex.sprint("\\def\\ndtheme{nddark}")
46+
else
47+
tex.sprint("\\def\\ndtheme{ndlight}")
48+
end
49+
}
50+
51+
% Math color command for preserving existing color usage
52+
\makeatletter
53+
\def\mathcolor#1#{\@mathcolor{#1}}
54+
\def\@mathcolor#1#2#3{%
55+
\protect\leavevmode
56+
\begingroup
57+
\color#1{#2}#3%
58+
\endgroup
59+
}
60+
\makeatother

0 commit comments

Comments
 (0)