Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

[CHANGE] CSS Bundling, New Themes, General Overhaul

62 views
Skip to first unread message

Rob Beezer

unread,
Dec 23, 2024, 7:48:06 PM12/23/24
to pretext-...@googlegroups.com
[Ed. From Andrew Scholer, joint work with Oscar Levin]

A significant overhaul has been made to the CSS (styling) for web builds of
PreTeXt books. This work enables easier distribution (every book will have only
a single CSS file) and better tooling for developing and maintaining styles.

This work facilitated a new set of "themes" for web builds. The biggest new
feature in these themes is support for a "dark mode". Dark mode respects the
reader's browser/OS settings but can also be enabled or disabled with a button
in the navbar. For examples of the new themes, see the Guide section on
Conversion to Online HTML, Styling
<https://pretextbook.org/doc/guide/online-style.html> (and try out the dark mode
button while you are there - look for the moon icon)

If you are an author wearing your publisher hat:
Theme selection is controlled by the publication/html/css element. If you don't
specify a @theme or @style there, you will get the new "default-modern" theme.

The previous CSS ("legacy" styles) still exist and will be used by any book that
defines a publication/html/css/@style that matches an old option ("default",
"crc". "oscarlevin", "wide", "soundwriting"). None of the old attributes for
publication/html/css other than @style and @colors will be applied - it is no
longer possible (or necessary) to specify different styles for different parts
of the page (navbar, table of contents, etc...).

If you want to use a new theme, delete any attributes present in
publication/html/css and set @theme to one of the options described in the Guide
section Online (HTML) Options, HTML Style (Theme)
<https://pretextbook.org/doc/guide/publication-file-online.html#online-style-options>.
That section also lists the other attributes that can be set to modify the
appearance of a given theme (e.g. change the primary color).

Using new themes other than "default-modern" will require your system to have
Node installed and that you use npm to install needed tools (one time). If you
are using the CLI, this will be managed for you. If you are using the pretext
script, you will need to do this manually
<https://pretextbook.org/doc/guide/node-and-npm.html>.

If you are interested in doing CSS/Theme development:
See the README file in the CSS/ directory of the pretext sources. Feel free to
reach out on the -dev mailing list with questions.

Rob Beezer

unread,
Dec 24, 2024, 10:37:08 AM12/24/24
to pretext-...@googlegroups.com
Correction: link to get started is

https://pretextbook.org/doc/guide/html/online-style.html

(Thanks to Tom S for the catch.)
Reply all
Reply to author
Forward
0 new messages