dtwrks/elm-book/1.3.0

NOTE: the latest version is 1.5.1

ElmBook.ThemeOptions

Use the attributes provided by this module to customize your book through ElmBook.withThemeOptions.

Take a look at the "Theming" guide for some examples.

Header

subtitle : String -> ThemeOptions html -> ThemeOptions html

Define a custom subtitle for your book. This will appear below the title.

Color palette

background : String -> ThemeOptions html -> ThemeOptions html

Customize the background color of your book. Any valid value for the background CSS property will work.

backgroundGradient : String -> String -> ThemeOptions html -> ThemeOptions html

Customize the background of your book using a gradient by providing the start and end color. This is just a helper since the same thing can be achieved by using the background attribute.

accent : String -> ThemeOptions html -> ThemeOptions html

Customize the accent color of your book. This will change the color for a few different elements that sit on top of your background like the title and default logo.

Dark Mode

preferDarkMode : ThemeOptions html -> ThemeOptions html

Makes your book always start as dark mode.

Global CSS

globals : List html -> ThemeOptions html -> ThemeOptions html

Add global elements to your book. This can be helpful for things like CSS resets.

For instance, if you're using elm-tailwind-modules, this would be really helpful:

import Css.Global exposing (global)
import Tailwind.Utilities exposing (globalStyles)


book "MyApp"
    |> withThemeOptions [
        globals [ global globalStyles ]
    ]

Routing

useHashBasedNavigation : ThemeOptions html -> ThemeOptions html

By default ElmBook expects you to host it at the root of a SPA style server.

However, if you'd like to use ElmBook on other situations – like on a subfolder, or a static server without these redirection settings, or even in elm-reactor. You can use the hash based navigation as everything should work as expected.

Types

type alias ThemeOption html =
ThemeOptions html -> ThemeOptions html