Skip to content

Commit 3d08f86

Browse files
committed
Add docs for themes
1 parent 22ab716 commit 3d08f86

File tree

4 files changed

+76
-20
lines changed

4 files changed

+76
-20
lines changed

docs/themes.rst

+64-9
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,69 @@
33
Themes
44
========
55

6-
Theme support is a work in progress!
6+
Using a theme
7+
-------------
78

8-
In the meantime, you can add CSS (inline or via a link) directly in your
9-
presentation. Here is a non exhaustive list of CSS selector you might be
10-
interested in tweaking:
9+
Theme support is pretty recent in Slipshow. As a consequence, there aren't many themes to choose from... yet!
1110

12-
* ``.slip-body`` to restyle a slip, eg to add margin, set font size and color...
13-
* ``.block``, ``.theorem``, ``.lemma``, ``.definition``, ``.example``,
14-
``.corollary``, ``.remark``, for admonitions (with special rules when they
15-
have the attribute ``title`` defined),
16-
* Any non-specific elements, such as titles, paragraphs, ...
11+
To choose a theme, use the ``--theme`` argument. It can take the name of a builtin theme, a path to a css file, or a URL pointing to a CSS file.
12+
13+
Example:
14+
15+
.. code-block:: console
16+
17+
$ slipshow pres.md # Use the default theme
18+
$ slipshow --theme default pres.md # Use the default theme, explicitely
19+
$ slipshow --theme none pres.md # Do not include any theme
20+
$ slipshow --theme file.css pres.md # Use file.css as the theme
21+
$ # Use the linked file as the theme:
22+
$ slipshow --theme https://example.org/my-theme.css pres.md
23+
$ # /!\ Needs internet connection to view the presentation!
24+
25+
If you do not want to change the theme, but to extend it, use the ``--css`` argument instead.
26+
27+
Currently, only the default theme is builtin. However, you can write your own theme!
28+
29+
Creating a theme
30+
----------------
31+
32+
Creating a theme consists in writing a CSS file.
33+
34+
Each theme can define any CSS rule. Once Slipshow is more stable, it will provide a list of classes with their meaning, that is guaranteed not to change (even if the engine change).
35+
36+
Currently, the layouts may still slightly change, necessiting updates in the themes. However, these changes won't happen frequently, and will likely be easy to update!
37+
38+
Here are some classes that may be of interest for a theme writer:
39+
40+
- ``.slip-body`` to define the look of the content of a slip.
41+
- ``.block`` for the blocks, which can take a ``title="..."`` parameter. Similarly for ``.theorem``, ``.lemma``, ``.definition``, ``.example``, ``.corollary``, ``.remark``.
42+
- ``#slipshow-universe`` for styling the "universe", the element containing all of the presentation's elements.
43+
- ``#slipshow-open-window`` for styling the background color outside of the universe.
44+
- Titles. Make sure not to change the system UI.
45+
46+
If you want to change the font, make sure to have a self-contained css file, by using data URLs to embed the font in the CSS file. Example:
47+
48+
49+
.. code-block:: css
50+
51+
@font-face {
52+
font-family: 'Dosis';
53+
src: url(data:font/truetype;charset=utf-8;base64,AAEAAA...WggBEAAA=) format('truetype-variations');
54+
font-weight: 500;
55+
}
56+
57+
where the ``AAEAA...WggBEAAA=`` string can be found with the base64 utility, for instance:
58+
59+
.. code-block:: console
60+
61+
$ base64 -w 0 dosis-variable.ttf
62+
63+
Submitting a theme
64+
------------------
65+
66+
If you have written a theme, thank you! I'm happy to:
67+
68+
- Include a link to it in this documentation,
69+
- Maybe, even include it as a builtin theme!
70+
71+
This way, I can also ping you on breaking changes.

src/engine/themes/default.css

-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ h1:not(#slipshow-toc h1) {
1616
text-align: center;
1717
}
1818

19-
body.slipshow-drawing-mode {
20-
touch-action: pinch-zoom;
21-
}
22-
2319
/*************************************/
2420
/* Blocks */
2521
/*************************************/

src/engine/themes/system.css

+5
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,8 @@
5151
vertical-align: middle;
5252
line-height: 10vh;
5353
}
54+
55+
56+
body.slipshow-drawing-mode {
57+
touch-action: pinch-zoom;
58+
}

test/engine/basic.t/new_engine.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ Salut !
33

44

55

6-
{pause scroll}
6+
{pause scroll .theorem title="Hello"}
77
AAAAAAAAAAAAAA A
88

9-
{pause scroll}
9+
{pause scroll .definition}
1010
AAAAAAAAAAAAAA A
1111

12-
{pause scroll}
12+
{pause scroll .definition title="Yoyo"}
1313
AAAAAAAAAAAAAA A
1414

15-
{pause scroll}
15+
{pause scroll .corollary}
1616
AAAAAAAAAAAAAA A
1717

18-
{pause scroll}
18+
{pause scroll .corollary title="Coco"}
1919
AAAAAAAAAAAAAA A
2020

21-
{pause scroll}
21+
{pause scroll .remark}
2222
AAAAAAAAAAAAAA A
2323

24-
{pause scroll}
24+
{pause scroll .remark title="Rere"}
2525
AAAAAAAAAAAAAA A
2626

2727
{pause scroll}

0 commit comments

Comments
 (0)