Skip to content

Commit 8e9384b

Browse files
authored
Add color inversion for docs images in dark themes (#253)
* Add color inversion for docs images * Fix image location for prettyurls
1 parent ffa6cf9 commit 8e9384b

File tree

6 files changed

+173
-40
lines changed

6 files changed

+173
-40
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Doc Preview Cleanup
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
# Ensure that only one "Doc Preview Cleanup" workflow is force pushing at a time
8+
concurrency:
9+
group: doc-preview-cleanup
10+
cancel-in-progress: false
11+
12+
jobs:
13+
doc-preview-cleanup:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
steps:
18+
- name: Checkout gh-pages branch
19+
uses: actions/checkout@v4
20+
with:
21+
ref: gh-pages
22+
- name: Delete preview and history + push changes
23+
run: |
24+
if [ -d "${preview_dir}" ]; then
25+
git config user.name "Documenter.jl"
26+
git config user.email "[email protected]"
27+
git rm -rf "${preview_dir}"
28+
git commit -m "delete preview"
29+
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
30+
git push --force origin gh-pages-new:gh-pages
31+
fi
32+
env:
33+
preview_dir: previews/PR${{ github.event.number }}

docs/make.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ makedocs(; modules=[TensorKit, TensorKitSectors],
1212
sitename="TensorKit.jl",
1313
authors="Jutho Haegeman",
1414
warnonly=[:missing_docs, :cross_references],
15-
format=Documenter.HTML(; prettyurls=get(ENV, "CI", nothing) == "true",
16-
mathengine=MathJax()),
15+
format=Documenter.HTML(; prettyurls=true, mathengine=MathJax(),
16+
assets=["assets/custom.css"]),
1717
pages=pages,
1818
pagesonly=true)
1919

docs/src/assets/custom.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
14+
/* but disable for the two light themes */
15+
.theme--documenter-light .color-invertible {
16+
filter: invert(0%) hue-rotate(0deg) !important;
17+
-ms-filter: invert(var(0%)) !important;
18+
-webkit-filter: invert(var(0%)) hue-rotate(0deg) !important;
19+
}
20+
.theme--catppuccin-latte .color-invertible {
21+
filter: invert(0%) hue-rotate(0deg) !important;
22+
-ms-filter: invert(var(0%)) !important;
23+
-webkit-filter: invert(var(0%)) hue-rotate(0deg) !important;
24+
}

docs/src/man/categories.md

Lines changed: 66 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ matrix product), bottom to top (quantum field theory convention) or top to botto
4646
circuit convention). Throughout this manual, we stick to this latter convention (which is
4747
not very common in manuscripts on category theory):
4848

49-
![composition](img/diagram_morphism.svg)
49+
```@raw html
50+
<img src="../img/diagram_morphism.svg" alt="composition" class="color-invertible"/>
51+
```
5052

5153
The direction of the arrows, which become important once we introduce duals, are also
5254
subject to convention, and are here chosen to follow the arrow in ``f:W→V``, i.e. the
@@ -168,7 +170,9 @@ this gives rise to the following graphical notation for the tensor product of tw
168170
morphisms, and for a general morphism ``t`` between a tensor product of objects in source
169171
and target:
170172

171-
![tensorproduct](img/diagram-tensorproduct.svg)
173+
```@raw html
174+
<img src="../img/diagram-tensorproduct.svg" alt="tensorproduct" class="color-invertible"/>
175+
```
172176

173177
Another relevant example is the category ``\mathbf{SVect}_𝕜``, which has as objects *super
174178
vector spaces* over ``𝕜``, which are vector spaces with a ``ℤ₂`` grading, i.e.
@@ -258,7 +262,9 @@ coevaluation of ``V`` and ``W``, such that ``{}^{∨}W ⊗ {}^{∨}V`` is at lea
258262

259263
Graphically, we represent the exact pairing and snake rules as
260264

261-
![left dual](img/diagram-leftdual.svg)
265+
```@raw html
266+
<img src="../img/diagram-leftdual.svg" alt="left dual" class="color-invertible"/>
267+
```
262268

263269
Note that we denote the dual objects ``{}^{∨}V`` as a line ``V`` with arrows pointing in the
264270
opposite (i.e. upward) direction. This notation is related to quantum field theory, where
@@ -269,7 +275,9 @@ the left dual of ``V``. Likewise, we can also define a right dual ``V^{∨}`` of
269275
associated pairings, the right evaluation ``\tilde{ϵ}_V: V ⊗ V^{∨} → I`` and coevaluation
270276
``\tilde{η}_V: I → V^{∨} ⊗ V``, satisfying
271277

272-
![right dual](img/diagram-rightdual.svg)
278+
```@raw html
279+
<img src="../img/diagram-rightdual.svg" alt="right dual" class="color-invertible"/>
280+
```
273281

274282
In particular, one could choose ``\tilde{ϵ}_{{}^{∨}V} = ϵ_V`` and thus define ``V`` as the
275283
right dual of ``{}^{∨}V``. While there might be other choices, this choice must at least be
@@ -278,7 +286,9 @@ isomorphic, such that ``({}^{∨}V)^{∨} ≂ V``.
278286
If objects ``V`` and ``W`` have left (respectively right) duals, than for a morphism ``f ∈ \mathrm{Hom}(W,V)``, we furthermore define the left (respectively right)
279287
*transpose* ``{}^{∨}f ∈ \mathrm{Hom}({}^{∨}V, {}^{∨}W)`` (respectively ``f^{∨} ∈ \mathrm{Hom}(V^{∨}, W^{∨})``) as
280288

281-
![transpose](img/diagram-transpose.svg)
289+
```@raw html
290+
<img src="../img/diagram-transpose.svg" alt="transpose" class="color-invertible"/>
291+
```
282292

283293
where on the right we also illustrate the mapping from
284294
``t ∈ \mathrm{Hom}(W_1 ⊗ W_2 ⊗ W_3, V_1 ⊗ V_2)`` to a morphism in
@@ -339,7 +349,9 @@ and a right trace as
339349

340350
They are graphically represented as
341351

342-
![trace](img/diagram-trace.svg)
352+
```@raw html
353+
<img src="../img/diagram-trace.svg" alt="trace" class="color-invertible"/>
354+
```
343355

344356
and they do not need to coincide. Note that
345357
``\mathrm{tr}_{\mathrm{l}}(f) = \mathrm{tr}_{\mathrm{r}}(f*)`` and that
@@ -391,11 +403,15 @@ has been omitted). We also have ``λ_V ∘ τ_{V,I} = ρ_{V,I}``, ``ρ_V ∘ τ_
391403
The braiding isomorphism ``τ_{V,W}`` and its inverse are graphically represented as the
392404
lines ``V`` and ``W`` crossing over and under each other:
393405

394-
![braiding](img/diagram-braiding.svg)
406+
```@raw html
407+
<img src="../img/diagram-braiding.svg" alt="braiding" class="color-invertible"/>
408+
```
395409

396410
such that we have
397411

398-
![braiding relations](img/diagram-braiding2.svg)
412+
```@raw html
413+
<img src="../img/diagram-braiding2.svg" alt="braiding relations" class="color-invertible"/>
414+
```
399415

400416
where the expression on the right hand side, ``τ_{W,V}∘τ_{V,W}`` can generically not be
401417
simplified. Hence, for general braidings, there is no unique choice to identify a tensor in
@@ -420,7 +436,9 @@ of ``\mathbf{SVect}``, which will again be studied in detail at the end of this
420436
The braiding of a space and a dual space also follows naturally, it is given by
421437
``τ_{V^*,W} = λ_{W ⊗ V^*} ∘ (ϵ_V ⊗ \mathrm{id}_{W ⊗ V^*}) ∘ (\mathrm{id}_{V^*} ⊗ τ_{V,W}^{-1} ⊗ \mathrm{id}_{V^*}) ∘ (\mathrm{id}_{V^*⊗ W} ⊗ η_V) ∘ ρ_{V^* ⊗ W}^{-1}``, i.e.
422438

423-
![braiding dual](img/diagram-braidingdual.svg)
439+
```@raw html
440+
<img src="../img/diagram-braidingdual.svg" alt="braiding dual" class="color-invertible"/>
441+
```
424442

425443
**Balanced categories** ``C`` are braided categories that come with a **twist** ``θ``, a
426444
natural transformation from the identity functor ``1_C`` to itself, such that
@@ -441,7 +459,9 @@ and
441459
where we omitted the necessary left and right unitors and associators. Graphically, the
442460
twists and their inverse (for which we refer to [^turaev]) are then represented as
443461

444-
![twists](img/diagram-twists.svg)
462+
```@raw html
463+
<img src="../img/diagram-twists.svg" alt="twists" class="color-invertible"/>
464+
```
445465

446466
The graphical representation also makes it straightforward to verify that
447467
``(θ^{\mathrm{l}}_V)^* = θ^{\mathrm{r}}_{V^*}``,
@@ -465,7 +485,9 @@ structure, or, to define the exact pairing for the right dual functor as
465485

466486
or graphically
467487

468-
![pivotal from twist](img/diagram-pivotalfromtwist.svg)
488+
```@raw html
489+
<img src="../img/diagram-pivotalfromtwist.svg" alt="pivotal from twist" class="color-invertible"/>
490+
```
469491

470492
where we have drawn ``θ`` as ``θ^{\mathrm{l}}`` on the left and as ``θ^{\mathrm{r}}`` on
471493
the right, but in this case the starting assumption was that they are one and the same, and
@@ -520,7 +542,9 @@ In the graphical representation, the dagger of a morphism can be represented by
520542
the morphism around a horizontal axis, and then reversing all arrows (bringing them back to
521543
their original orientation before the mirror operation):
522544

523-
![dagger](img/diagram-dagger.svg)
545+
```@raw html
546+
<img src="../img/diagram-dagger.svg" alt="dagger" class="color-invertible"/>
547+
```
524548

525549
where for completeness we have also depicted the graphical representation of the transpose,
526550
which is a very different operation. In particular, the dagger does not reverse the order
@@ -704,7 +728,9 @@ fusion category, on which we now focus, the corresponding projection maps are
704728

705729
Graphically, we represent these relations as
706730

707-
![fusion](img/diagram-fusion.svg)
731+
```@raw html
732+
<img src="../img/diagram-fusion.svg" alt="fusion" class="color-invertible"/>
733+
```
708734

709735
and also refer to the inclusion and projection maps as splitting and fusion tensor,
710736
respectively.
@@ -744,7 +770,9 @@ thus represent a unitary basis transform between the basis of inclusion maps
744770
``X_{d,(eμν)}^{abc}`` and ``\tilde{X}_{d,(fκλ)}^{abc}``, which is also called an F-move,
745771
i.e. graphically:
746772

747-
![Fmove](img/diagram-Fmove.svg)
773+
```@raw html
774+
<img src="../img/diagram-Fmove.svg" alt="Fmove" class="color-invertible"/>
775+
```
748776

749777
The matrix ``F^{abc}_d`` is thus a unitary matrix. The pentagon coherence equation can also
750778
be rewritten in terms of these matrix elements, and as such yields the celebrated pentagon
@@ -757,7 +785,9 @@ triangle equation and its collaries imply that
757785
``[F^{1ab}_{c}]_{(11μ)}^{(cν1)} = δ^{ν}_{μ}``, and similar relations for ``F^{a1b}_c`` and
758786
``F^{ab1}_c``, which are graphically represented as
759787

760-
![Fmove1](img/diagram-Fmove1.svg)
788+
```@raw html
789+
<img src="../img/diagram-Fmove1.svg" alt="Fmove1" class="color-invertible"/>
790+
```
761791

762792
In the case of group representations, i.e. the category ``\mathbf{Rep}_{\mathsf{G}}``, the
763793
splitting and fusion tensors are known as the Clebsch-Gordan coefficients, especially in
@@ -803,7 +833,9 @@ for ``a=\bar{a}``, the value of ``χ_a`` cannot be changed, but must satisfy ``
803833
or thus ``χ_a = ±1``. This value is a topological invariant known as the
804834
*Frobenius-Schur indicator*. Graphically, we represent this isomorphism and its relations as
805835

806-
![Zisomorphism](img/diagram-Zisomorphism.svg)
836+
```@raw html
837+
<img src="../img/diagram-Zisomorphism.svg" alt="Zisomorphism" class="color-invertible"/>
838+
```
807839

808840
We can now discuss the relation between the exact pairing and the fusion and splitting
809841
tensors. Given that the (left) coevaluation ``η_a ∈ \mathrm{Hom}(1, a⊗a^*)``, we can define the
@@ -822,12 +854,16 @@ snake rules. Hence, both the quantum dimensions and the Frobenius-Schur indicato
822854
encoded in the F-symbol. Hence, they do not represent new independent data. Again, the
823855
graphical representation is more enlightning:
824856

825-
![ZtoF](img/diagram-ZtoF.svg)
857+
```@raw html
858+
<img src="../img/diagram-ZtoF.svg" alt="ZtoF" class="color-invertible"/>
859+
```
826860

827861
With these definitions, we can now also evaluate the action of the evaluation map on the
828862
splitting tensors, namely
829863

830-
![splittingfusionrelation](img/diagram-splittingfusionrelation.svg)
864+
```@raw html
865+
<img src="../img/diagram-splittingfusionrelation.svg" alt="splittingfusionrelation" class="color-invertible"/>
866+
```
831867

832868
where again bar denotes complex conjugation in the second line, and we introduced two new
833869
families of matrices ``A^{ab}_c`` and ``B^{ab}_c``, whose entries are composed out of
@@ -843,7 +879,9 @@ Composing the left hand side of first graphical equation with its dagger, and no
843879
the resulting element ``f ∈ \mathrm{End}(a)`` must satisfy
844880
``f = d_a^{-1} \mathrm{tr}(f) \mathrm{id}_a``, i.e.
845881

846-
![Brelation](img/diagram-Brelation.svg)
882+
```@raw html
883+
<img src="../img/diagram-Brelation.svg" alt="Brelation" class="color-invertible"/>
884+
```
847885

848886
allows to conclude that
849887
``∑_ν [B^{ab}_c]^{ν}_{μ} \overline{[B^{ab}_c]^{ν}_{μ′}} = \delta_{μ,μ′}``, i.e. ``B^{ab}_c``
@@ -893,7 +931,9 @@ the simple objects. We can then express ``τ_{a,b}`` in terms of its matrix elem
893931

894932
or graphically
895933

896-
![braidingR](img/diagram-braidingR.svg)
934+
```@raw html
935+
<img src="../img/diagram-braidingR.svg" alt="braidingR" class="color-invertible"/>
936+
```
897937

898938
The hexagon coherence axiom for the braiding and the associator can then be reexpressed in
899939
terms of the F-symbols and R-symbols.
@@ -905,7 +945,9 @@ complex phases because of unitarity) multiplying the identity morphism, i.e.
905945

906946
or graphically
907947

908-
![simpletwist](img/diagram-simpletwist.svg)
948+
```@raw html
949+
<img src="../img/diagram-simpletwist.svg" alt="simpletwist" class="color-invertible"/>
950+
```
909951

910952
Henceforth, we reserve ``θ_a`` for the scalar value itself. Note that ``θ_a = θ_{\bar{a}}``
911953
as our category is spherical and thus a ribbon category, and that the defining relation of
@@ -916,7 +958,9 @@ a twist implies
916958
If ``a = \bar{a}``, we can furthermore relate the twist, the braiding and the Frobenius-
917959
Schur indicator via ``θ_a χ_a R^{aa}_1 =1``, because of
918960

919-
![twistfrobeniusschur](img/diagram-twistfrobeniusschur.svg)
961+
```@raw html
962+
<img src="../img/diagram-twistfrobeniusschur.svg" alt="twistfrobeniusschur" class="color-invertible"/>
963+
```
920964

921965
For the recurring example of ``\mathbf{Rep}_{\mathsf{G}}``, the braiding acts simply as the
922966
swap of the two vector spaces on which the representations are acting and is thus symmetric,

0 commit comments

Comments
 (0)