runtime: font roles in the theme API (fonts per role, --wb-font-<role> vars, UI kit uses the dialog/mono roles); theme schema: font.roles with Google Fonts source
This commit is contained in:
parent
ae64714913
commit
e07eee0041
3 changed files with 114 additions and 12 deletions
|
|
@ -41,8 +41,22 @@
|
|||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"family": { "$ref": "#/$defs/fontStack", "description": "Interface font stack; empty keeps the site's font." },
|
||||
"tweet": { "$ref": "#/$defs/fontStack", "description": "Optional stack for post text only." },
|
||||
"family": { "$ref": "#/$defs/fontStack", "description": "Interface font stack; empty keeps the site's font. Shorthand of roles.interface.family (kept for older apps); when roles.interface is present it wins." },
|
||||
"tweet": { "$ref": "#/$defs/fontStack", "description": "Post text stack; shorthand of roles.post.family (roles.post wins)." },
|
||||
"roles": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Which font goes where. A role is \"inherit\" (the interface font; an inheriting mono role keeps a monospaced face) or its own stack with optional settings.",
|
||||
"properties": {
|
||||
"interface": { "$ref": "#/$defs/interfaceRole", "description": "The site's whole UI; every other role inherits it." },
|
||||
"post": { "$ref": "#/$defs/fontRole", "description": "Post text." },
|
||||
"heading": { "$ref": "#/$defs/fontRole", "description": "Display names and headings." },
|
||||
"numbers": { "$ref": "#/$defs/fontRole", "description": "Counts (likes, reposts, followers)." },
|
||||
"mono": { "$ref": "#/$defs/fontRole", "description": "Code." },
|
||||
"chrome": { "$ref": "#/$defs/fontRole", "description": "The app's own window: tabs, address bar, titlebar, panel." },
|
||||
"dialog": { "$ref": "#/$defs/fontRole", "description": "Plugin dialogs and toasts (the UI kit)." }
|
||||
}
|
||||
},
|
||||
"scale": { "type": "number", "minimum": 0.85, "maximum": 1.2, "default": 1 },
|
||||
"weight": { "type": "integer", "minimum": 300, "maximum": 500, "default": 400 },
|
||||
"bold": { "type": "integer", "minimum": 500, "maximum": 800, "default": 700 },
|
||||
|
|
@ -142,6 +156,36 @@
|
|||
},
|
||||
"$defs": {
|
||||
"hex": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
|
||||
"source": { "const": "google", "description": "The first family is a Google Fonts family: apps download it (asking first for an imported theme) and load it from bytes." },
|
||||
"interfaceRole": {
|
||||
"oneOf": [
|
||||
{ "const": "inherit" },
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["family"],
|
||||
"additionalProperties": false,
|
||||
"properties": { "family": { "$ref": "#/$defs/fontStack" }, "source": { "$ref": "#/$defs/source" } }
|
||||
}
|
||||
]
|
||||
},
|
||||
"fontRole": {
|
||||
"oneOf": [
|
||||
{ "const": "inherit" },
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["family"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"family": { "$ref": "#/$defs/fontStack", "description": "Empty keeps the inherited family and changes only the settings below." },
|
||||
"source": { "$ref": "#/$defs/source" },
|
||||
"weight": { "type": "integer", "minimum": 100, "maximum": 900 },
|
||||
"size": { "type": "number", "minimum": 0.75, "maximum": 1.5, "description": "Relative to the site's size." },
|
||||
"tracking": { "type": "number", "minimum": -0.05, "maximum": 0.1, "description": "Letter spacing in em." },
|
||||
"tabular": { "type": "boolean", "description": "Tabular (fixed-width) figures." }
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"fontStack": {
|
||||
"type": "array",
|
||||
"maxItems": 8,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue