Skip to content

Commit 5746be2

Browse files
authored
feat: unify background config with auto-detection and Figma component backgrounds (#17)
1 parent fdb3a98 commit 5746be2

18 files changed

Lines changed: 1850 additions & 201 deletions

File tree

CLAUDE.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,20 @@ Global settings at file start, or per-slide after `---`:
240240
```yaml
241241
---
242242
figdeck: true # Required for VSCode extension to recognize file
243-
background: "#1a1a2e" # Solid color
244-
gradient: "#0d1117:0%,#1f2937:50%,#58a6ff:100%@45" # Gradient with angle
245-
template: "Style Name" # Figma paint style name
246-
backgroundImage: "./bg.png" # Local image (PNG, JPEG, GIF)
247-
backgroundImage: "https://..." # Remote image URL
243+
background: "#1a1a2e" # Solid color (auto-detect)
244+
background: "#0d1117:0%,#58a6ff:100%@45" # Gradient (auto-detect)
245+
background: "./bg.png" # Local image (auto-detect)
246+
background: "https://figma.com/...?node-id=123-456" # Figma component (auto-detect)
247+
background: # Object format (explicit)
248+
color: "#1a1a2e" # Solid color
249+
gradient: "#0d1117:0%,#58a6ff:100%@45" # Gradient with angle
250+
template: "Style Name" # Figma paint style name
251+
image: "./bg.png" # Local image (PNG, JPEG, GIF) or URL
252+
component: # Figma Component/Frame as background
253+
link: "https://www.figma.com/design/xxx?node-id=123-456"
254+
fit: "cover" # cover | contain | stretch
255+
align: "center" # center | top-left | top-right | bottom-left | bottom-right
256+
opacity: 0.8 # 0-1
248257
color: "#ffffff" # Base text color for all elements
249258
headings:
250259
h1: { size: 72, color: "#fff" }
@@ -294,7 +303,7 @@ transition: # Full configuration
294303
---
295304
```
296305

297-
**Background Priority:** templateStyle > gradient > solid > image
306+
**Background Priority (object format):** template > gradient > color > image
298307

299308
**Transition Styles:** `none`, `dissolve`, `smart-animate`, `slide-from-*`, `push-from-*`, `move-from-*`, `slide-out-to-*`, `move-out-to-*` (where * = left, right, top, bottom)
300309

@@ -338,7 +347,7 @@ Supported text override formatting: **bold**, *italic*, ~~strikethrough~~, [link
338347
- `fonts.md` - Custom font family configuration
339348
- `slide-numbers.md` - Slide number configuration
340349
- `figma-links.md` - Figma node embedding
341-
- `backgrounds.md` - Background styles
350+
- `backgrounds.md` - All background types (color, gradient, image, template, Figma component)
342351
- `rich-formatting.md` - Inline formatting
343352
- `transitions.md` - Slide transition animations
344353
- `images.md` - Image size and position specifications (Marp-style)

examples/backgrounds.md

Lines changed: 76 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ background: "#1a1a2e"
44
color: "#ffffff"
55
---
66

7-
# Background & Text Color Examples
7+
# Background Examples
88

9-
This presentation demonstrates background and text color options.
9+
This presentation demonstrates all background options.
1010

1111
All slides use dark background with white text by default.
1212

@@ -19,31 +19,21 @@ This slide uses the global settings from YAML frontmatter.
1919
No per-slide frontmatter needed!
2020

2121
---
22-
22+
background: "#16213e"
2323
---
2424

25-
## background: "#16213e"
26-
2725
## Override with Different Color
2826

2927
- This slide overrides the default with its own frontmatter
3028
- Per-slide settings take priority over global defaults
3129

3230
---
33-
31+
background: "#0d1117:0%,#1f2937:50%,#3b82f6:100%@45"
3432
---
3533

36-
## gradient: "#0d1117:0%,#1f2937:50%,#3b82f6:100%@45"
34+
# Gradient Background
3735

38-
# Gradient Override
39-
40-
Gradients also override the default background.
41-
42-
---
43-
44-
## Back to Default
45-
46-
This slide has no frontmatter, so it uses the global default again.
36+
Gradients are auto-detected from the string format.
4737

4838
---
4939
background: "#f0f4f8"
@@ -55,20 +45,18 @@ color: "#020202"
5545
This slide uses light background with dark text.
5646

5747
---
58-
backgroundImage: "https://images.unsplash.com/photo-1557683316-973673baf926?w=1920&h=1080&fit=crop"
48+
background: "https://images.unsplash.com/photo-1557683316-973673baf926?w=1920&h=1080&fit=crop"
5949
color: "#ffffff"
6050
---
6151

6252
## Remote Background Image
6353

6454
This slide uses a remote image URL as background.
6555

66-
The image is fetched by the Figma plugin.
56+
URLs are auto-detected as images.
6757

6858
---
69-
70-
---
71-
backgroundImage: "./local-bg.png"
59+
background: "./local-bg.png"
7260
color: "#ffffff"
7361
---
7462

@@ -79,21 +67,80 @@ This slide uses a local image file.
7967
The CLI reads and embeds the image as base64.
8068

8169
---
70+
background:
71+
template: "Inter"
72+
---
8273

83-
## Summary
74+
## Template Style
75+
76+
Use a Figma paint style by name.
77+
78+
---
79+
background: "https://figma.com/...?node-id=123-456"
80+
---
81+
82+
## Figma Component (URL Shorthand)
8483

85-
YAML frontmatter format:
84+
Copy a Figma link with node-id from your Component or Frame.
85+
86+
The component will be scaled to cover the slide by default.
87+
88+
---
89+
background:
90+
component:
91+
link: "https://figma.com/...?node-id=123-456"
92+
fit: "contain"
93+
align: "center"
94+
---
95+
96+
## Figma Component Options
97+
98+
- `fit`: cover (default), contain, stretch
99+
- `align`: center (default), top-left, top-right, bottom-left, bottom-right
100+
- `opacity`: 0-1
101+
102+
---
103+
background:
104+
color: "#1a1a2e"
105+
component:
106+
link: "https://figma.com/...?node-id=123-456"
107+
fit: "cover"
108+
opacity: 0.8
109+
---
110+
111+
## Combined Background
112+
113+
Component can be combined with color/gradient/image.
114+
115+
The component renders as a layer on top of the base fill.
116+
117+
---
118+
119+
## Summary
86120

87121
```yaml
88122
---
123+
# String format (auto-detect)
89124
background: "#1a1a2e" # Solid color
90-
gradient: "#0d1117:0%,#58a6ff:100%@45" # Gradient
91-
backgroundImage: "./bg.png" # Local image
92-
backgroundImage: "https://..." # Remote image URL
93-
color: "#ffffff" # Text color
125+
background: "#000:0%,#fff:100%" # Gradient
126+
background: "./bg.png" # Local image
127+
background: "https://..." # Remote image
128+
background: "https://figma.com/...?node-id=123-456" # Figma component
129+
130+
# Object format (explicit)
131+
background:
132+
color: "#1a1a2e"
133+
gradient: "#000:0%,#fff:100%@45"
134+
template: "Style Name"
135+
image: "./bg.png"
136+
component:
137+
link: "https://figma.com/...?node-id=123-456"
138+
fit: "cover" # cover | contain | stretch
139+
align: "center" # center | top-left | ...
140+
opacity: 0.8 # 0-1
94141
---
95142
```
96143

97-
Global (file start) sets defaults, per-slide overrides.
144+
Priority: template > gradient > color > image
98145

99-
Priority: template > gradient > solid > image
146+
Component works with same-file nodes only (MVP limitation).

0 commit comments

Comments
 (0)