Module packages.resilient.bookmatters
Book matter support (front and back covers, half-title, title pages, endpapers, etc.) for re·sil·ient.
This package is for internal use only. It is used (mostly) by the "master document". API is subject to change.
Info:
- Copyright: (c) 2023-2025 Omikhkeia / Didier Willis
- License: MIT
Local Functions
getTemplateInclude (template, metaopts) | Resolve a template and prepare an include command specification. |
weightedColorDistanceIn3D (color) | Compute a weighted color distance in 3D space. |
contrastColor (color) | Compute the best contrast color (black or white) for a given background color. |
Class packages.resilient.bookmatters
package:_init (options) | (Constructor) Initialize the package. |
package:registerCommands () | (Override) Register package commands. |
package:registerStyles () | (Override) Register package styles. |
Local Functions
- getTemplateInclude (template, metaopts)
-
Resolve a template and prepare an include command specification.
Parameters:
- template string Template name (without extension)
- metaopts table Initial options (metadata) to pass to the include command
Returns:
-
table
Include command options
Raises:
Error if the template cannot be found - weightedColorDistanceIn3D (color)
-
Compute a weighted color distance in 3D space.
Parameters:
- color SILE.types.color Input color (RGB only for now)
- contrastColor (color)
-
Compute the best contrast color (black or white) for a given background color.
Parameters:
- color SILE.types.color Input color (RGB only for now)
Returns:
-
string
"black" or "white"
Class packages.resilient.bookmatters
The "bookmatters" package.
Extends packages.resilient.base.
- package:_init (options)
-
(Constructor) Initialize the package.
Parameters:
- options table Package options
- package:registerCommands ()
- (Override) Register package commands.
- package:registerStyles ()
- (Override) Register package styles.