|
3 | 3 | Themes
|
4 | 4 | ========
|
5 | 5 |
|
6 |
| -Theme support is a work in progress! |
| 6 | +Using a theme |
| 7 | +------------- |
7 | 8 |
|
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! |
11 | 10 |
|
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. |
0 commit comments