Skip to content

Commit bac4fbd

Browse files
authored
Set up optional color inversion for docs images (#305)
* Start * One picture at a time * Update some examples * Small fix
1 parent e740d6a commit bac4fbd

File tree

19 files changed

+2019
-1024
lines changed

19 files changed

+2019
-1024
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<img src="https://github.com/QuantumKitHub/MPSKit.jl/blob/master/docs/src/assets/logo.svg" width="150">
1+
<img src="./docs/src/assets/logo_readme.svg" width="150">
22

33
# MPSKit.jl
44

docs/make.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ mathengine = MathJax3(Dict(:loader => Dict("load" => ["[tex]/physics"]),
4141
makedocs(;
4242
sitename="MPSKit.jl",
4343
format=Documenter.HTML(;
44-
prettyurls=get(ENV, "CI", nothing) == "true",
44+
prettyurls=true,
4545
mathengine,
46-
size_threshold=1024000),
46+
assets=["assets/custom.css"],
47+
size_threshold=1024000,),
4748
pages=["Home" => "index.md",
4849
"Manual" => ["man/intro.md",
4950
"man/states.md",

docs/src/assets/custom.css

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/* set fixed non-trivial inversion and hue rotation */
2+
:root {
3+
--inversionFraction: 100%;
4+
--hueRotation: -180deg;
5+
}
6+
7+
/* color-invert images */
8+
.color-invertible {
9+
filter: invert(var(--inversionFraction)) hue-rotate(var(--hueRotation)) !important;
10+
-ms-filter: invert(var(--inversionFraction)) !important;
11+
-webkit-filter: invert(var(--inversionFraction)) hue-rotate(var(--hueRotation)) !important;
12+
}
13+
/* including the logo */
14+
.docs-logo {
15+
filter: invert(var(--inversionFraction)) hue-rotate(var(--hueRotation)) !important;
16+
-ms-filter: invert(var(--inversionFraction)) !important;
17+
-webkit-filter: invert(var(--inversionFraction)) hue-rotate(var(--hueRotation)) !important;
18+
}
19+
20+
21+
/* but disable for the two light themes */
22+
.theme--documenter-light .color-invertible {
23+
filter: invert(0%) hue-rotate(0deg) !important;
24+
-ms-filter: invert(var(0%)) !important;
25+
-webkit-filter: invert(var(0%)) hue-rotate(0deg) !important;
26+
}
27+
.theme--catppuccin-latte .color-invertible {
28+
filter: invert(0%) hue-rotate(0deg) !important;
29+
-ms-filter: invert(var(0%)) !important;
30+
-webkit-filter: invert(var(0%)) hue-rotate(0deg) !important;
31+
}
32+
/* for the logo as well */
33+
.theme--documenter-light .docs-logo {
34+
filter: invert(0%) hue-rotate(0deg) !important;
35+
-ms-filter: invert(var(0%)) !important;
36+
-webkit-filter: invert(var(0%)) hue-rotate(0deg) !important;
37+
}
38+
.theme--catppuccin-latte .docs-logo {
39+
filter: invert(0%) hue-rotate(0deg) !important;
40+
-ms-filter: invert(var(0%)) !important;
41+
-webkit-filter: invert(var(0%)) hue-rotate(0deg) !important;
42+
}

docs/src/assets/logo_readme.svg

Lines changed: 18 additions & 0 deletions
Loading

docs/src/examples/quantum1d/1.ising-cft/index.md

Lines changed: 217 additions & 220 deletions
Large diffs are not rendered by default.

docs/src/examples/quantum1d/1.ising-cft/main.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@
8585
"through the use of the translation operator. This operator can be defined in MPO language\n",
8686
"either diagramatically as\n",
8787
"\n",
88-
"![translation operator MPO](translation_mpo.png)\n",
88+
"\n",
89+
"<img src=\"translation_mpo.svg\" alt=\"translation operator\" class=\"color-invertible\" width=\"50%\"/>\n",
90+
"\n",
8991
"\n",
9092
"or in the code as:"
9193
],
-4.71 KB
Binary file not shown.

0 commit comments

Comments
 (0)