Theme Lexicon
The site.standard.theme.basic lexicon provides a simplified theme definition for publications, enabling basic color customization for content display across different platforms and applications.
Overview
This lexicon ensures publications maintain their visual identity across different reading applications and platforms by defining core colors for content display.
Schema
Required Properties
| Property | Type | Description |
|---|---|---|
| background | ref | Color used for content background (ref → site.standard.theme.color#rgb) |
| foreground | ref | Color used for content text (ref → site.standard.theme.color#rgb) |
| accent | ref | Color used for links and button backgrounds (ref → site.standard.theme.color#rgb) |
| accentForeground | ref | Color used for button text (ref → site.standard.theme.color#rgb) |
Color Format
Colors are defined using the site.standard.theme.color#rgb type from the site.standard.theme.color lexicon.
RGB Color Type
Each color is an object with three required integer properties:
| Property | Type | Range | Description |
|---|---|---|---|
| r | integer | 0-255 | Red channel value |
| g | integer | 0-255 | Green channel value |
| b | integer | 0-255 | Blue channel value |
RGBA Color Type
The site.standard.theme.color lexicon also defines an rgba type for colors with transparency:
| Property | Type | Range | Description |
|---|---|---|---|
| r | integer | 0-255 | Red channel value |
| g | integer | 0-255 | Green channel value |
| b | integer | 0-255 | Blue channel value |
| a | integer | 0-100 | Alpha (opacity) value, where 0 is transparent and 100 is opaque |
Color Roles
- background: Main surface color for content areas
- foreground: Default color for body text and content
- accent: Color for interactive elements like links and button backgrounds
- accentForeground: Text color used on accent-colored backgrounds (ex: button text)
Usage in Publications
Include the basic theme in your publication record:
{
"$type": "site.standard.publication",
"url": "https://myblog.com",
"name": "My Blog",
"basicTheme": {
"$type": "site.standard.theme.basic",
"background": {
"$type": "site.standard.theme.color#rgb",
"r": 255,
"g": 255,
"b": 255
},
"foreground": {
"$type": "site.standard.theme.color#rgb",
"r": 31,
"g": 41,
"b": 55
},
"accent": {
"$type": "site.standard.theme.color#rgb",
"r": 59,
"g": 130,
"b": 246
},
"accentForeground": {
"$type": "site.standard.theme.color#rgb",
"r": 255,
"g": 255,
"b": 255
}
}
}
Best Practices
- Consider readability: Ensure foreground/background combinations are legible
- Test button colors: Verify accent/accentForeground pairs have sufficient contrast
- Provide all required properties: All four color properties are required for a valid theme
Related
- Publication lexicon - Publications can include basicTheme
- Quick Start - Implementation guide
- Implementations - See how platforms use theming