figmatk 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@
13
13
  {
14
14
  "name": "figmatk",
15
15
  "description": "Swiss Army Knife for Figma Files (.deck)",
16
- "version": "0.2.0",
16
+ "version": "0.2.2",
17
17
  "author": {
18
18
  "name": "FigmaTK Contributors"
19
19
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figmatk",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Create and edit Figma Slides .deck files programmatically — no Figma API required",
5
5
  "author": {
6
6
  "name": "FigmaTK Contributors"
package/lib/api.mjs CHANGED
@@ -561,7 +561,7 @@ export class Slide {
561
561
  addRectangle(x, y, width, height, opts = {}) {
562
562
  const fd = this._fd;
563
563
  const localID = fd.maxLocalID() + 1;
564
- const fill = opts.fill ?? { r: 1, g: 1, b: 1, a: 1 };
564
+ const fill = parseColor(fd, opts.fill ?? 'White');
565
565
 
566
566
  const node = {
567
567
  guid: { sessionID: 1, localID },
@@ -904,7 +904,7 @@ export class Slide {
904
904
  _addShapeWithText(shapeType, x, y, width, height, opts = {}) {
905
905
  const fd = this._fd;
906
906
  const localID = fd.maxLocalID() + 1;
907
- const fill = opts.fill ?? { r: 1, g: 1, b: 1, a: 1 };
907
+ const fill = parseColor(fd, opts.fill ?? 'White');
908
908
  const fillPaint = {
909
909
  type: 'SOLID',
910
910
  color: { r: fill.r, g: fill.g, b: fill.b, a: fill.a ?? 1 },
@@ -1185,7 +1185,7 @@ export class Slide {
1185
1185
  fd.message.blobs.push({ bytes: _buildVectorNetworkBlob(allCmds) });
1186
1186
  const vnbIdx = fd.message.blobs.length - 1;
1187
1187
 
1188
- const fill = opts.fill ?? { r: 0, g: 0, b: 0 };
1188
+ const fill = parseColor(fd, opts.fill ?? 'Black');
1189
1189
  const opacity = opts.opacity ?? 1;
1190
1190
 
1191
1191
  const frameId = nextId++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figmatk",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Figma Toolkit — Swiss-army knife CLI for Figma .deck and .fig files",
5
5
  "type": "module",
6
6
  "bin": {
@@ -6,7 +6,7 @@ description: >
6
6
  clone or remove slides, or produce a .deck file for Figma Slides.
7
7
  Powered by FigmaTK under the hood.
8
8
  metadata:
9
- version: "0.2.0"
9
+ version: "0.2.2"
10
10
  ---
11
11
 
12
12
  # Figma Slides Creator
@@ -119,7 +119,7 @@ node /tmp/figmatk-ws/deck.mjs
119
119
  | `setBackground` with hex | `s.setBackground('#1A1A1A')` | `s.setBackground('Black')` |
120
120
  | `setBackground` with raw RGB | `s.setBackground({ r:0.1, g:0.1, b:0.1 })` | `s.setBackground('Black')` — raw RGB silently renders white |
121
121
  | Shape method signature | `s.addRectangle({ x:0, y:0, width:100 })` | `s.addRectangle(0, 0, 100, 100, opts)` |
122
- | Shape fill color | `{ fill: '#F4900C' }` | `{ fill: hex('#F4900C') }` — use the hex() helper |
122
+ | Shape fill color | `{ fill: { r:1, g:0, b:0 } }` | `{ fill: '#F4900C' }` or `{ fill: 'Red' }` — hex strings and named colors work directly |
123
123
  | `addLine` options | `{ strokeColor: ..., strokeWeight: 2 }` | `{ color: 'Black', weight: 2 }` |
124
124
  | `align` value | `align: 'left'` | `align: 'LEFT'` (uppercase) |
125
125
  | `addImage` without await | `slide.addImage('/tmp/photo.jpg')` | `await slide.addImage('/tmp/photo.jpg')` — async, images silently missing without await |
@@ -176,7 +176,7 @@ slide.addTriangle(x, y, width, height, opts)
176
176
  slide.addStar(x, y, width, height, opts)
177
177
  slide.addLine(x1, y1, x2, y2, opts) // opts: color, weight
178
178
  await slide.addImage(pathOrBuf, opts) // ⚠️ ASYNC — must use await; opts: x, y, width, height (default: full slide 1920×1080), cornerRadius, opacity
179
- slide.addTable(data, opts) // 2D string array; opts: x, y, width, colWidths, rowHeight
179
+ slide.addTable(x, y, data, opts) // 2D string array; opts: width, colWidths, rowHeight
180
180
  slide.addSVG(x, y, width, svgPathOrBuf, opts)
181
181
  ```
182
182