bookcover-core

中文文档
0.24.0发布于 2026/11/03MIT-0TypeScriptES Module

Part of the bookcover generation system.

原始使用文档
文档目录8 节
  1. Printing / size
  2. Title
  3. Subtitle
  4. Author
  5. Blurb (back panel)
  6. Spine
  7. Background
  8. Other

bookcover-core — schema reference

Part of the bookcover generation system.

This is the core generator package — not used directly. Install bookcover-node for Node.js or bookcover-web for the browser. This document describes the schema accepted by both.

All colors must be HSL strings in the format hsl(200deg, 50%, 30%).

Printing / size

FieldTypeNotes
service_idstringPrinting service: kdp, lulu, officeworks, vistaprint_au, ctrlprint
binding_typestringe.g. paperback, hardcover — depends on service
size_idstring?e.g. us_trade, a5 — omit if using custom dimensions
page_countnumber?Required when using size_id
ink_typestring?e.g. bw, color — required by some services
paper_typestring?e.g. white, cream — required by some services
custom_unitstring?mm or in — for custom dimensions
custom_trim_widthnumber?Trim width in custom_unit
custom_trim_heightnumber?Trim height in custom_unit
custom_bleednumber?Bleed in custom_unit
custom_spinenumber?Spine width in custom_unit
margin_frontnumber?Front panel text margin as % of trim height
margin_backnumber?Back panel text margin as % of trim height

Title

Three title lines (title1, title2, title3) each share the same set of options. title1 is the main title.

FieldTypeNotes
title1stringMain title (default '')
title1_font{family: string}?Font family name as used in Typst
title1_sizenumber?Relative size multiplier (default 1.0)
title1_weightnumber?CSS-style weight 100–900 (default 700)
title1_italicboolean?
title1_colorhsl?Defaults to contrasting color vs bg_color
title_alignmentcenter|left|right?
title_positiontop|middle|bottomRequired
title_spacingnumber?Gap between title lines as % of trim height
title_margin_topnumber?Top margin as % of trim height
title_margin_bottomnumber?Bottom margin as % of trim height

title2 and title3 have the same _font, _size, _weight, _italic, _color fields; title2/title3 color defaults to title1_color.

Subtitle

FieldTypeNotes
subtitlestring(default '')
subtitle_font{family: string}?
subtitle_sizenumber?
subtitle_weightnumber?100–900
subtitle_italicboolean?
subtitle_colorhsl?
subtitle_alignmentcenter|left|right?
subtitle_positiontop|middle|bottomRequired
subtitle_spacingnumber?Gap between subtitle lines as % of trim height
subtitle_margin_topnumber?
subtitle_margin_bottomnumber?

Author

FieldTypeNotes
authorstring(default '')
author_font{family: string}?
author_sizenumber?
author_weightnumber?100–900
author_italicboolean?
author_colorhsl?
author_alignmentcenter|left|right?
author_positiontop|middle|bottomRequired
author_margin_topnumber?
author_margin_bottomnumber?

Blurb (back panel)

FieldTypeNotes
blurbstringBack cover text (default '')
blurb_font{family: string}?
blurb_sizenumber?
blurb_colorhsl?
blurb_bg_colorhsl|null?undefined = derive from bg_color; null = transparent
blurb_alignmentcenter|left|right|justified?
blurb_paddingnumber?Padding as % of trim height
blurb_widthnumber?Width as % of face width
blurb_spacingnumber?Line spacing multiplier (1 = default Typst leading)

Spine

Spine text defaults to the front title and author if not set. Pass '' to explicitly suppress spine text.

FieldTypeNotes
spine_titlestring?Omit to derive from title1; '' to suppress
spine_title_font{family: string}?
spine_title_sizenumber?
spine_title_weightnumber?
spine_title_italicboolean?
spine_title_colorhsl?
spine_authorstring?Omit to derive from author; '' to suppress
spine_author_font{family: string}?
spine_author_sizenumber?
spine_author_weightnumber?
spine_author_italicboolean?
spine_author_colorhsl?
spine_colorhsl|null?null = no separate spine color (uses primary bg)

Background

FieldTypeNotes
bg_colorhsl?Primary background color
bg_color_gradientboolean?Apply gradient to background
bg_image_coveragefull|front|painted|feature|front_partial?How the background image is placed
icon_idstring?Iconify ID (e.g. game-icons:sailboat) or raw SVG
icon_modecenter|offset|echo|background?
icon_sizenumber?Relative size multiplier, range 0.25–4
icon_colorstring?
icon_spineboolean?Show icon on spine
patternstring?Raw SVG string tiled as background pattern
pattern_tile_mmnumber?Pattern tile size in mm (default 80)
pattern_colorstring?

Other

FieldTypeNotes
isbnstringISBN-13; generates barcode on back cover (default '')

版本与发布记录

bookcover-core 共发布 28 个版本,首次发布于 2026/07/16;过去 12 个月发布了 28 个版本。

版本发布日期距今
0.24.0latest2026/11/03今天
0.23.02026/10/267 天前
0.22.32026/10/2311 天前
0.22.22026/10/2212 天前
0.22.12026/10/2212 天前
0.22.02026/10/2212 天前

关于 bookcover-core 的常见问题

bookcover-core 是什么?

部分 封套 一代系统。

如何安装 bookcover-core?

在项目目录运行 npm install bookcover-core,或使用 pnpm add / yarn add / bun add。

bookcover-core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

bookcover-core 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

bookcover-core 可以商用吗?

bookcover-core 使用 MIT-0 许可。声明的许可为 MIT-0,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

bookcover-core 还在维护吗?

最新版本 0.24.0 发布于 2026/11/03(今天);至今共发布 28 个版本,其中过去 12 个月发布了 28 个;首次发布于 2026/07/16。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。