generated from fastn-stack/fastn-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
figma-to-ftd.ftd
382 lines (262 loc) · 8.96 KB
/
figma-to-ftd.ftd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
-- import: heulitig.github.io/figma-tokens-tutorial/json-to-ftd as j
-- import: fifthtry.github.io/forest-cs as forest-cs
-- import: heulitig.github.io/figma-tokens-tutorial/assets as assets
-- import: fastn/processors as pr
-- string forest-figma:
$processor$: pr.figma-cs-token
variable: $forest-cs.main
name: forest-cs
-- ds.page: How to create your own `Fastn Color Scheme` from Figma json
It happens quite often that we get a hold of some nice color-scheme
package which we believe would look good on our pages
but we don't want to use the same color-scheme as it is. Sometimes, we
want to do some tweaks on top of that already good looking color-scheme and create
our own super awesome color-scheme specific for our websites.
In `ftd`, you can create your own color-scheme package from
the exported fastn color-scheme json generated from figma.
If you have come here, you might be already familiar
with using fastn color-scheme json in Figma using `Token Studio for Figma` plugin.
If not, then [visit this guide](https://fastn.io/figma).
Let's say we want to modify forest-cs colors and create our own dark-forest-cs
-- ds.h1: Install figma tokens plugin
If you already have this
[`Token Studio for figma` (Figma Tokens)](https://www.figma.com/community/plugin/843461159747178978/Tokens-Studio-for-Figma-(Figma-Tokens))
plugin installed, then awesome. If not, then visit the above link.
-- ds.h1: Open your Figma file
You can use any of your existing figma file or create a new one as shown below.
-- ftd.image:
src: $assets.files.static.b2.0.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
In this tutorial, I will be using the same figma file which I used in this
[tutorial guide](https://fastn.io/figma)
-- ds.h1: Create forest-cs.json file
Copy the below json and create a new file named "forest-cs.json"
using any of your favourite text editor (for eg. Sublime Text)
and save it.
-- ds.code: forest-cs
lang: json
max-height: 350
$forest-figma
-- ds.h1: Load forest-cs.json in figma plugin
Once you have launched your figma tokens plugin,
head to `Tools` -> `Load from File/Folder or Preset` as shown below
-- ftd.image:
src: $assets.files.static.b2.1.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
Then under `File` tab, click on `Choose File` option
-- ftd.image:
src: $assets.files.static.b2.2.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
It will show a File picker, open your `forest-cs.json` file
which you saved as shown below.
-- ftd.image:
src: $assets.files.static.b2.3.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
Then tick the `forest-cs-light` checkbox to set the
light color-scheme in your page.
-- ftd.image:
src: $assets.files.static.b2.4.png
height.fixed.px: 350
width: fill-container
-- ds.h1: Check your component colors
You will notice that the rectangle is using this color: `Background Colors -> base`
inside your figma plugin once you select the rectangle as shown below.
-- ftd.image:
src: $assets.files.static.b2.6.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
And text is using this color: `Standalone Colors -> text`
-- ftd.image:
src: $assets.files.static.b2.7.png
height.fixed.px: 350
width: fill-container
-- ds.h1: Let's modify some colors
Guess what we don't like any of these two colors at all
in this light color scheme.
Let's say we want the `Background Colors -> base`
to be some light green color (for eg. #90EE90)
instead of the boring white :(
To do this, right click on the current active color circle i.e
`Background Colors -> base` and click on Edit token option
as shown below
-- ftd.image:
src: $assets.files.static.b2.5.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
You will see this window once you hit Edit token option.
On this window, edit the Color value to
this #90EE90 (for light green color) then hit Save button
as shown below.
-- ftd.image:
src: $assets.files.static.b2.8.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
Similarly, select the text-block and edit its color by right-clicking
on its color circle i.e Standalone Colors -> text as shown below
-- ftd.image:
src: $assets.files.static.b2.9.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
Now change this color by changing its Color value
to #0b5394 (for blue color) then hit Save button
-- ftd.image:
src: $assets.files.static.b2.10.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
This looks much better now :)
-- ftd.image:
src: $assets.files.static.b2.11.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
After doing such color modifications, you might
want to save your color-scheme as a fastn color-scheme package.
For this, we can convert this json generated from this color-scheme
to FTD code which we can use in our fastn color-scheme package.
-- ds.h1: Let's convert json to FTD
To export your color-scheme as json, click on Export to File/Folder under Tools
in your Figma Tokens plugin as shown below.
-- ftd.image:
src: $assets.files.static.b2.12.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
After doing that, copy the json from the preview section as shown below.
-- ftd.image:
src: $assets.files.static.b2.13.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
As you can see, this json is for light color-scheme. Similarly copy
the dark color-scheme json from preview section and make one json
after merging both jsons.
-- ds.markdown:
And paste this merged json in the text-box below.
-- j.json-exporter:
-- ds.markdown:
You will see the generated FTD code. Copy this FTD code by clicking
on the copy icon at the top of the code-block above.
-- ds.h1: Go to the github repo of `sailing-shark-cs`
This repo is a template repo for fastn color-schemes, we will create
our own color-scheme repo using this.
To do that, click on the `Use this template` button then `Create a new repository`
as shown below
-- ftd.image:
src: $assets.files.static.b2.22.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
Fill your repository details as shown below, then click on `Create repository
from template` button.
-- ftd.image:
src: $assets.files.static.b2.23.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
Wait for a while, after that you will see your color-scheme repository
created using this template like this:
-- ftd.image:
src: $assets.files.static.b2.24.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
But before you can use this repo, you need to do setup some things
-- ds.h1: Modify the FASTN.ftd
Change the fastn.package and download-base-url
based on your repo name and username as shown below.
-- ftd.image:
src: $assets.files.static.b2.25.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
To edit this file, hit the edit icon as shown below
and make your changes
-- ftd.image:
src: $assets.files.static.b2.26.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
Like this
-- ftd.image:
src: $assets.files.static.b2.27.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
When you are done updating the contents, scroll down and save changes
by committing directly on the main branch as shown below.
-- ftd.image:
src: $assets.files.static.b2.28.png
height.fixed.px: 350
width: fill-container
-- ds.h1: Modify index.ftd
Just like we updated FASTN.ftd, update the import for the colors
based on your username and repository name as shown below.
-- ftd.image:
src: $assets.files.static.b2.29.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
Like this
-- ftd.image:
src: $assets.files.static.b2.30.png
height.fixed.px: 350
width: fill-container
-- ds.h1: Modify colors.ftd
Go to your colors.ftd file in your repo and click on the edit button
-- ftd.image:
src: $assets.files.static.b2.35.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
Then Paste your copied FTD code.
Scroll down and commit directly to the main branch by
press on Commit changes button as shown below.
-- ftd.image:
src: $assets.files.static.b2.30.png
height.fixed.px: 350
width: fill-container
-- ds.h1: Activate github pages
Now to activate github pages (gh-pages) go to Settings as shown below
-- ftd.image:
src: $assets.files.static.b2.31.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
Go to Pages tab
-- ftd.image:
src: $assets.files.static.b2.32.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
Then select the Source to `Deploy from the branch`
and select the branch to `gh-pages`, then hit Save
as shown below.
-- ftd.image:
src: $assets.files.static.b2.33.png
height.fixed.px: 350
width: fill-container
-- ds.h1: Preview your color-scheme in action
Go to your (`<github-username>.github.io/<repo>`) page to see your
color-scheme in action.
In my case, my color-scheme will be deployed at
`heulitig.github.io/my-color-scheme` as shown below
-- ftd.image:
src: $assets.files.static.b2.final.png
height.fixed.px: 350
width: fill-container
-- ds.markdown:
Congratulations you have completed this tutorial.
-- end: ds.page