typey 1.0.0.beta.5 → 1.0.0.beta.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +134 -416
- data/stylesheets/_typey.scss +13 -7
- data/stylesheets/typey/_defaults.scss +13 -39
- data/stylesheets/typey/_font-stacks.scss +0 -14
- data/stylesheets/typey/functions/_depreciated.scss +55 -0
- data/stylesheets/typey/functions/_em-calculators.scss +41 -0
- data/stylesheets/typey/{_weight.scss → functions/_extras.scss} +10 -8
- data/stylesheets/typey/functions/_helpers.scss +32 -0
- data/stylesheets/typey/functions/_outputters.scss +83 -0
- data/stylesheets/typey/functions/_sizers.scss +117 -0
- data/stylesheets/typey/functions/_validators.scss +77 -0
- data/stylesheets/typey/mixins/_define-type-sizing.scss +49 -0
- data/stylesheets/typey/mixins/_font-size.scss +24 -0
- data/stylesheets/typey/mixins/_line-height.scss +25 -0
- data/stylesheets/typey/{_margin.scss → mixins/_margin.scss} +30 -37
- data/stylesheets/typey/{_padding.scss → mixins/_padding.scss} +30 -37
- data/stylesheets/typey/mixins/_type-layout.scss +53 -0
- data/typey.gemspec +2 -2
- metadata +16 -10
- data/stylesheets/typey/_font-size.scss +0 -56
- data/stylesheets/typey/_helpers.scss +0 -171
- data/stylesheets/typey/_line-height.scss +0 -63
- data/stylesheets/typey/_type-layout.scss +0 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8898792b278d464c815124ef1afbaa7ae18ea7a6
|
4
|
+
data.tar.gz: 222024e2a09ab32650c7220aa09427c12e54fca8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d601cc92f82925469b575f6260cf7bf872926dff1ad1e2645f8b8a4cfdc24a4edbb67c10c4f0eefc30b7171466ec9323141619d8c50f5ce25a7a22d7f89ad7f
|
7
|
+
data.tar.gz: 2cdd1be4ec90de348a3ec457be208fe50bcb6663ab628da9e48c4a31e70893408168f06b0ff63fc08d81a18b6f056cec6b1e5b475aba3b5a2fd7c9eff7ec78ad
|
data/README.md
CHANGED
@@ -2,131 +2,93 @@
|
|
2
2
|
|
3
3
|
A complete framework for working with typography on the web.
|
4
4
|
|
5
|
-
|
5
|
+
## Requirements
|
6
6
|
|
7
|
-
|
7
|
+
Sass 3.3.0
|
8
8
|
|
9
|
-
|
10
|
-
$base-unit: rem;
|
11
|
-
```
|
9
|
+
## Installation
|
12
10
|
|
13
|
-
|
11
|
+
With RubyGems & Compass:
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
l: 24px,
|
19
|
-
m: 16px,
|
20
|
-
s: 14px,
|
21
|
-
);
|
13
|
+
* Terminal: `gem install typey`
|
14
|
+
* config.rb: `require 'typey'`
|
15
|
+
* SCSS: `@import 'typey'`
|
22
16
|
|
23
|
-
|
24
|
-
@include font-size(xl);
|
25
|
-
}
|
26
|
-
```
|
17
|
+
Bower
|
27
18
|
|
28
|
-
|
19
|
+
* Terminal: `bower install typey`
|
20
|
+
* SCSS: `@import '../link_to_component_dir/typey'`
|
29
21
|
|
30
|
-
|
31
|
-
h1 {
|
32
|
-
font-size: 32px;
|
33
|
-
font-size: 2rem;
|
34
|
-
}
|
35
|
-
```
|
22
|
+
Vanilla Sass
|
36
23
|
|
37
|
-
|
24
|
+
* Terminal: 'git clone git@github.com:jptaranto/typey.git
|
25
|
+
* SCSS: `@import '../link_to_component_dir/typey/stylesheets/typey'`
|
38
26
|
|
39
|
-
|
40
|
-
button {
|
41
|
-
@include font-size(29px);
|
42
|
-
}
|
43
|
-
```
|
27
|
+
## Getting started
|
44
28
|
|
45
|
-
|
29
|
+
### How do I tell typey what to do?
|
46
30
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
font-size: 12pt;
|
51
|
-
}
|
52
|
-
}
|
53
|
-
```
|
31
|
+
Firstly, all values you input to typey are expressed with `px` as the unit, and
|
32
|
+
only `px` as the unit. This allows us to be completely consistent when dealing
|
33
|
+
with typography in our stylesheets.
|
54
34
|
|
55
|
-
|
35
|
+
Secondly, all strings in typey are expressed without quotes. Yes no quotes. This
|
36
|
+
makes for leaner and cleaner code.
|
56
37
|
|
57
|
-
|
58
|
-
h2 {
|
59
|
-
@include line-height(3);
|
60
|
-
@incude margin(10px 0);
|
61
|
-
}
|
62
|
-
```
|
38
|
+
### Decide how you want typey to output
|
63
39
|
|
64
|
-
|
40
|
+
Now you'll need to choose the unit typey outputs your values in. You have three
|
41
|
+
choices: `rem`, `em`, or `px`. Each has it's own pros and cons. We don't quite
|
42
|
+
have enough space here to go over them so do your research before you jump in.
|
43
|
+
Generally speaking, it is actually quite easy to change this value in typey later on.
|
65
44
|
|
66
45
|
```sass
|
67
|
-
$
|
68
|
-
bold: 700,
|
69
|
-
normal: 400,
|
70
|
-
lighter: 200
|
71
|
-
);
|
72
|
-
|
73
|
-
strong {
|
74
|
-
font-weight: weight(bold)
|
75
|
-
}
|
46
|
+
$base-unit: rem;
|
76
47
|
```
|
77
48
|
|
78
|
-
|
49
|
+
Just like in compass Vertical Rhythm we define our base font size and line height.
|
79
50
|
|
80
51
|
```sass
|
81
|
-
$
|
52
|
+
$base-font-size: 16px;
|
53
|
+
$base-line-height: 20px;
|
82
54
|
```
|
83
55
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
With RubyGems & Compass:
|
91
|
-
|
92
|
-
* Terminal: `gem install typey`
|
93
|
-
* config.rb: `require 'typey'`
|
94
|
-
* SCSS: `@import 'typey'`
|
95
|
-
|
96
|
-
Bower
|
97
|
-
|
98
|
-
* Terminal: `bower install typey`
|
99
|
-
* SCSS: `@import '../link_to_component_dir/typey'`
|
100
|
-
|
101
|
-
Vanilla Sass
|
102
|
-
|
103
|
-
* Terminal: 'git clone git@github.com:jptaranto/typey.git
|
104
|
-
* SCSS: `@import '../link_to_component_dir/typey/stylesheets/typey'`
|
56
|
+
Ok, so we have our base sizing, now we need to choose the approach that we are going
|
57
|
+
to layout type with. We have two options available to us: rhythm and ratio. Rhythm
|
58
|
+
allows us to specify line-heights as a multiple of $base-line-height, where as ratio
|
59
|
+
allows us to specify line-heights as a multiple of our elements font-size. Rhythm is
|
60
|
+
the default, but for beginners working with web typography the simplest approach
|
61
|
+
is to use ratio. Each example below will tell you which method it is for.
|
105
62
|
|
106
|
-
|
63
|
+
```sass
|
64
|
+
$line-height-method: rhythm;
|
65
|
+
```
|
107
66
|
|
108
|
-
|
67
|
+
or
|
109
68
|
|
110
69
|
```sass
|
111
|
-
$
|
112
|
-
$base-line-height: 24px;
|
70
|
+
$line-height-method: ratio;
|
113
71
|
```
|
114
72
|
|
115
|
-
|
73
|
+
If you are using ratio, you should set your base ratio as so. Ignore this one
|
74
|
+
if you are using rhythm.
|
116
75
|
|
117
76
|
```sass
|
118
|
-
$base-
|
77
|
+
$base-line-height-ratio: 1.25
|
119
78
|
```
|
120
79
|
|
121
|
-
|
80
|
+
By default typey will create print friendly stylesheets by adding a print media
|
81
|
+
query to the `html` element with a font-size defined in `pt`. This is really only
|
82
|
+
effective when you are using a relative unit as your `$base-unit` (rem or em). You
|
83
|
+
can override the base print size with this variable.
|
122
84
|
|
123
85
|
```sass
|
124
|
-
|
125
|
-
@include define-type-sizing;
|
126
|
-
}
|
86
|
+
$print-font-size: 12pt;
|
127
87
|
```
|
128
88
|
|
129
|
-
|
89
|
+
Ok on to the fun stuff. Defining font sizes! You should define as many of your
|
90
|
+
font-sizes as possible inside the `$font-size` map with t-shirt sizes (which are
|
91
|
+
easier to keep track of than individual values).
|
130
92
|
|
131
93
|
```sass
|
132
94
|
$font-size: (
|
@@ -137,61 +99,56 @@ $font-size: (
|
|
137
99
|
);
|
138
100
|
```
|
139
101
|
|
140
|
-
|
102
|
+
Now we are all set, we need to define our defaults for the `html` element. We can
|
103
|
+
do this as easily as below:
|
141
104
|
|
142
105
|
```sass
|
143
|
-
|
106
|
+
html {
|
107
|
+
@include define-type-sizing;
|
108
|
+
}
|
144
109
|
```
|
145
110
|
|
146
|
-
|
111
|
+
## The quickest way to lay out type. Ever.
|
147
112
|
|
148
|
-
|
113
|
+
### Rhythm method
|
114
|
+
|
115
|
+
In the example below, we are taking a heading, giving it an extra-large font-size and
|
116
|
+
setting it's line-height to be 2x the $base-line-height.
|
149
117
|
|
150
118
|
```sass
|
151
119
|
h1 {
|
152
|
-
@include
|
120
|
+
@include type-layout(xl, 2);
|
153
121
|
}
|
154
122
|
```
|
155
123
|
|
156
|
-
|
124
|
+
### Ratio method
|
157
125
|
|
158
|
-
|
159
|
-
|
160
|
-
@include line-height(2);
|
161
|
-
}
|
162
|
-
```
|
163
|
-
|
164
|
-
Or for those finicky designs, you can just use a static `px` value for granular control.
|
126
|
+
As we have already set a base ratio, we don't really need to worry about setting
|
127
|
+
the line-height as all elements will just inherit from the `html` element.
|
165
128
|
|
166
129
|
```sass
|
167
|
-
|
168
|
-
@include
|
130
|
+
h1 {
|
131
|
+
@include font-size(xl);
|
169
132
|
}
|
170
133
|
```
|
171
134
|
|
172
|
-
|
135
|
+
But if we did want to override the base ratio, we can do it like so:
|
173
136
|
|
174
137
|
```sass
|
175
|
-
|
176
|
-
@include type-layout(xl,
|
138
|
+
h1 {
|
139
|
+
@include type-layout(xl, 1.75);
|
177
140
|
}
|
178
141
|
```
|
179
142
|
|
180
|
-
|
181
|
-
|
182
|
-
```sass
|
183
|
-
h4 {
|
184
|
-
@include type-layout(xl, 2);
|
143
|
+
All ratios are outputted as `em` instead of your base unit as they will always
|
144
|
+
be relative to their element's font-size.
|
185
145
|
|
186
|
-
|
187
|
-
@include type-layout(s, 2, xl);
|
188
|
-
}
|
189
|
-
}
|
190
|
-
```
|
146
|
+
## Add some margins or padding
|
191
147
|
|
192
|
-
|
193
|
-
|
194
|
-
|
148
|
+
A key component of typography is the space between elements. Typey always uses
|
149
|
+
a vertical rhythm approach for margins and padding regardless of whether you are
|
150
|
+
using the ratio method. This way margins and padding will always be consistent
|
151
|
+
in your stylesheets. You can specify these using the various margin and padding mixins.
|
195
152
|
|
196
153
|
```sass
|
197
154
|
div {
|
@@ -199,9 +156,6 @@ div {
|
|
199
156
|
@include margin-right(1);
|
200
157
|
@include margin-bottom(2);
|
201
158
|
@include margin-left(1);
|
202
|
-
}
|
203
|
-
|
204
|
-
form {
|
205
159
|
@include padding-top(2);
|
206
160
|
@include padding-right(1);
|
207
161
|
@include padding-bottom(2);
|
@@ -218,340 +172,104 @@ div {
|
|
218
172
|
}
|
219
173
|
```
|
220
174
|
|
221
|
-
|
175
|
+
## Slightly tricky stuff
|
222
176
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
}
|
229
|
-
```
|
230
|
-
|
231
|
-
### Extras
|
232
|
-
|
233
|
-
Grab one of the web-safe font stacks included and extend it with your own fonts.
|
234
|
-
|
235
|
-
```sass
|
236
|
-
$your-font-stack: extend-font-stack("Open sans", $sans-serif-stack);
|
237
|
-
```
|
238
|
-
|
239
|
-
If you are using a web font that has multiple different weights, you can express these as numerical values, inside a sass map. Then if things change later on, it's easy as pie to change them site-wide.
|
177
|
+
Every now and then you aren't going to want to specify a size or height as a multiple,
|
178
|
+
ratio, or even a value from the `$font-size` map. You are going to want the ability
|
179
|
+
to override things with actual `px` values and have them output properly in your
|
180
|
+
base unit of choice. This is particularly useful for things like buttons or nav
|
181
|
+
bars when you want to have an exact px height.
|
240
182
|
|
241
183
|
```sass
|
242
|
-
|
243
|
-
|
244
|
-
normal: 400,
|
245
|
-
lighter: 200
|
246
|
-
);
|
247
|
-
```
|
248
|
-
|
249
|
-
You can then use typey's built in `weight()` function to call these values in an easy and readable way.
|
250
|
-
|
251
|
-
```sass
|
252
|
-
strong {
|
253
|
-
font-weight: weight(bold)
|
184
|
+
button {
|
185
|
+
@include line-height(50px);
|
254
186
|
}
|
255
187
|
```
|
256
188
|
|
257
|
-
|
258
|
-
|
259
|
-
### Variables
|
189
|
+
Or for fidely, one-off font sizes.
|
260
190
|
|
261
191
|
```sass
|
262
|
-
|
192
|
+
.nav__dropdown-link {
|
193
|
+
@include font-size(22px);
|
194
|
+
}
|
263
195
|
```
|
264
196
|
|
265
|
-
|
266
|
-
|
197
|
+
Or for some spacing you want to set manually.
|
267
198
|
|
268
199
|
```sass
|
269
|
-
|
200
|
+
li {
|
201
|
+
@include margin(5px 0);
|
202
|
+
@include padding(2px 0);
|
203
|
+
}
|
270
204
|
```
|
271
205
|
|
272
|
-
|
273
|
-
|
206
|
+
All of typey's mixins accept a px value instead of a multiple/ratio or key from
|
207
|
+
the font-size map.
|
274
208
|
|
209
|
+
## Really quite tricky stuff (em as the $base-unit)
|
275
210
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
Allowed units: px
|
211
|
+
Ok so what if you are really adventurous and want to use `em` as your base unit.
|
212
|
+
Being relative to the element or parent's font-size, `em` can be particularly tricky when you
|
213
|
+
have nested elements that you want to set a font-size or line-height for. To do
|
214
|
+
this, each typey mixin has a $context argument that can be used to correctly
|
215
|
+
set what the sizing should be relative too.
|
282
216
|
|
217
|
+
In the below example we want to set the font size of a heading, and then give
|
218
|
+
the nested span element a smaller font size. We do this by passing the font-size
|
219
|
+
of the parent as the second argument to the mixin.
|
283
220
|
|
284
221
|
```sass
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
Allowed units: rem, em or px.
|
289
|
-
|
222
|
+
h2 {
|
223
|
+
@include font-size(l);
|
290
224
|
|
291
|
-
|
292
|
-
|
225
|
+
span {
|
226
|
+
@include font-size(m, l);
|
227
|
+
}
|
228
|
+
}
|
293
229
|
```
|
294
230
|
|
295
|
-
|
231
|
+
If we are using the type-layout() mixin we can do the same thing like below:
|
296
232
|
|
297
233
|
```sass
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
By default, when rem or em are the base unit we will output a print suitable media query with the define-type-sizing() mixin. This will take care of all print media type sizing effortlessly.
|
234
|
+
h2 {
|
235
|
+
@include type-layout(l, 2);
|
302
236
|
|
303
|
-
|
304
|
-
|
237
|
+
span {
|
238
|
+
@include type-layout(m, 2, l);
|
239
|
+
}
|
240
|
+
}
|
305
241
|
```
|
306
242
|
|
307
|
-
|
308
|
-
Allowed units: pt
|
243
|
+
## Extras
|
309
244
|
|
245
|
+
Grab one of the web-safe font stacks included and extend it with your own fonts.
|
310
246
|
|
311
247
|
```sass
|
312
|
-
$font-
|
313
|
-
xxxl: 60px,
|
314
|
-
xxl: 46px,
|
315
|
-
xl: 32px,
|
316
|
-
l: 24px,
|
317
|
-
m: 16px,
|
318
|
-
s: 14px,
|
319
|
-
xs: 12px
|
320
|
-
) !default;
|
248
|
+
$your-font-stack: extend-font-stack("Open sans", $sans-serif-stack);
|
321
249
|
```
|
322
250
|
|
323
|
-
|
324
|
-
Once you redefine the $font-size map it will overwrite all sizes here.
|
325
|
-
Allowed units: px
|
326
|
-
|
251
|
+
If you are using a web font that has multiple different weights, you can express these as numerical values, inside a sass map. Then if things change later on, it's easy as pie to change them site-wide.
|
327
252
|
|
328
253
|
```sass
|
329
254
|
$font-weight: (
|
330
|
-
bold:
|
331
|
-
normal:
|
332
|
-
lighter:
|
333
|
-
)
|
334
|
-
```
|
335
|
-
|
336
|
-
Default font weights
|
337
|
-
This map and accompanying function help provide granular control over setting and retrieving static font weights.
|
338
|
-
|
339
|
-
### Mixins
|
340
|
-
|
341
|
-
```sass
|
342
|
-
define-type-sizing($base-font-size: $base-font-size, $base-line-height: $base-line-height)
|
343
|
-
```
|
344
|
-
|
345
|
-
Outputs the base font-size property and the base line-height property. Font-size is outputted as a % of the base browser font size. A fallback for rem is provided for the line-height property.
|
346
|
-
|
347
|
-
*@param number $base-font-size*
|
348
|
-
(optional) Use to set to anything other than the base value. Allowed units: px
|
349
|
-
|
350
|
-
*@param number $base-line-height(optional)*
|
351
|
-
Use to set to anything other than the base value. Allowed units: px
|
352
|
-
|
353
|
-
|
354
|
-
```sass
|
355
|
-
type-layout($size, $x, $context: $size)
|
356
|
-
```
|
357
|
-
|
358
|
-
Outputs both line-height and font-size properties, providing fallbacks when rem is the base unit.
|
359
|
-
|
360
|
-
*@param number|string $size*
|
361
|
-
A size from the $font-size map or a px value.
|
362
|
-
|
363
|
-
*@param number $x*
|
364
|
-
Multiple of line height to be used or px value to be converted.
|
365
|
-
|
366
|
-
*@param number|string $context*
|
367
|
-
(optional) Only used if em is the $base-unit. The value of the elements/parents font-size if it differs from $base-font-size. Specified as a t-shirt size or value in px.
|
368
|
-
|
369
|
-
|
370
|
-
```sass
|
371
|
-
font-size($size, $context: $base-font-size)
|
372
|
-
```
|
373
|
-
|
374
|
-
Outputs font-size property, providing fallbacks when rem is the base unit.
|
375
|
-
|
376
|
-
*@param number|string $size*
|
377
|
-
A size from the $font-size map or px value to be converted
|
378
|
-
|
379
|
-
*@param number|string $context*
|
380
|
-
(optional) Only used if em is the $base-unit. The value of the parent font-size if it differs from $base-font-size. Specified as a t-shirt size or value in px.
|
381
|
-
|
382
|
-
|
383
|
-
```sass
|
384
|
-
line-height($x, $context: $base-font-size)
|
385
|
-
```
|
386
|
-
|
387
|
-
Outputs line-height property, providing fallbacks when rem is the base unit.
|
388
|
-
|
389
|
-
*@param number $x*
|
390
|
-
Multiple of line height to be used or px value to be converted.
|
391
|
-
|
392
|
-
*@param number|string $context*
|
393
|
-
(optional) Only used if em is the $base-unit. The value of the elements/parentsfont-size if it differs from $base-font-size. Specified as a t-shirt size or value in px.
|
394
|
-
|
395
|
-
|
396
|
-
```sass
|
397
|
-
margin($x, $context: $base-font-size)
|
398
|
-
```
|
399
|
-
|
400
|
-
Outputs margin property, providing fallbacks when rem is the base unit.
|
401
|
-
|
402
|
-
*@param number|list $x*
|
403
|
-
Multiple of line height to be used or px value to be converted.
|
404
|
-
Uses the same parameters as the CSS margin property:
|
405
|
-
i.e. top right bottom left, 1 0 2 0.
|
406
|
-
|
407
|
-
*@param number|string $context*
|
408
|
-
(optional) Only used if em is the $base-unit. The value of the elements/parents font-size if it differs from $base-font-size. Specified as a t-shirt size or value in px.
|
409
|
-
|
410
|
-
|
411
|
-
```sass
|
412
|
-
padding($x, $context: $base-font-size)
|
413
|
-
```
|
414
|
-
|
415
|
-
Outputs padding property, providing fallbacks when rem is the base unit.
|
416
|
-
|
417
|
-
*@param number|list $x*
|
418
|
-
Multiple of line height to be used or px value to be converted.
|
419
|
-
Uses the same parameters as the CSS margin property:
|
420
|
-
i.e. top right bottom left, 1 0 2 0.
|
421
|
-
|
422
|
-
*@param number|string $context*
|
423
|
-
(optional) Only used if em is the $base-unit. The value of the elements/parents font-size if it differs from $base-font-size. Specified as a t-shirt size or value in px.
|
424
|
-
|
425
|
-
|
426
|
-
```sass
|
427
|
-
margin-top($x, $context: $base-font-size)
|
428
|
-
margin-right($x, $context: $base-font-size)
|
429
|
-
margin-bottom($x, $context: $base-font-size)
|
430
|
-
margin-left($x, $context: $base-font-size)
|
431
|
-
```
|
432
|
-
|
433
|
-
Outputs corresponding margin property, providing fallbacks when rem is the base unit.
|
434
|
-
|
435
|
-
*@param number|list $x*
|
436
|
-
Multiple of line height to be used or px value to be converted.
|
437
|
-
|
438
|
-
*@param number|string $context*
|
439
|
-
(optional) Only used if em is the $base-unit. The value of the elements/parents font-size if it differs from $base-font-size. Specified as a t-shirt size or value in px.
|
440
|
-
|
441
|
-
|
442
|
-
```sass
|
443
|
-
padding-top($x, $context: $base-font-size)
|
444
|
-
padding-right($x, $context: $base-font-size)
|
445
|
-
padding-bottom($x, $context: $base-font-size)
|
446
|
-
padding-left($x, $context: $base-font-size)
|
447
|
-
```
|
448
|
-
|
449
|
-
Outputs corresponding padding property, providing fallbacks when rem is the base unit.
|
450
|
-
|
451
|
-
*@param number|list $x*
|
452
|
-
Multiple of line height to be used or px value to be converted.
|
453
|
-
|
454
|
-
*@param number|string $context*
|
455
|
-
(optional) Only used if em is the $base-unit. The value of the elements/parents font-size if it differs from $base-font-size. Specified as a t-shirt size or value in px.
|
456
|
-
|
457
|
-
### Functions
|
458
|
-
|
459
|
-
```sass
|
460
|
-
font-size($size, $context: $base-font-size)
|
461
|
-
```
|
462
|
-
|
463
|
-
*@param number|string $size*
|
464
|
-
A size from the $font-size map or px value to be converted
|
465
|
-
|
466
|
-
*@param number|string $context*
|
467
|
-
(optional) Only used if em is the $base-unit. The value of the parent font-size if it differs from $base-font-size. Specified as a t-shirt size or value in px.
|
468
|
-
|
469
|
-
*@return number*
|
470
|
-
The selected font-size in $base-unit.
|
471
|
-
|
472
|
-
|
473
|
-
```sass
|
474
|
-
line-height($x, $context: $base-font-size)
|
475
|
-
```
|
476
|
-
|
477
|
-
*@param number $x*
|
478
|
-
Multiple of line height to be used or px value to be converted.
|
479
|
-
|
480
|
-
*@param number|string $context*
|
481
|
-
(optional) Only used if em is the $base-unit. The value of the elements/parentsfont-size if it differs from $base-font-size. Specified as a t-shirt size or value in px.
|
482
|
-
|
483
|
-
*@return number*
|
484
|
-
The calculated height in $base-unit.
|
485
|
-
|
486
|
-
|
487
|
-
```sass
|
488
|
-
margin($x, $context: $base-font-size)
|
489
|
-
```
|
490
|
-
|
491
|
-
*@param number $x*
|
492
|
-
Multiple of line height to be used or px value to be converted.
|
493
|
-
|
494
|
-
*@param number|string $context*
|
495
|
-
(optional) Only used if em is the $base-unit. The value of the elements/parents font-size if it differs from $base-font-size. Specified as a t-shirt size or value in px.
|
496
|
-
|
497
|
-
*@return number*
|
498
|
-
The calculated height in $base-unit.
|
499
|
-
|
500
|
-
|
501
|
-
```sass
|
502
|
-
padding($x, $context: $base-font-size)
|
503
|
-
```
|
504
|
-
|
505
|
-
*@param number $x*
|
506
|
-
Multiple of line height to be used or px value to be converted.
|
507
|
-
|
508
|
-
*@param number|string $context*
|
509
|
-
(optional) Only used if em is the $base-unit. The value of the elements/parents font-size if it differs from $base-font-size. Specified as a t-shirt size or value in px.
|
510
|
-
|
511
|
-
*@return number*
|
512
|
-
The calculated height in $base-unit.
|
513
|
-
|
514
|
-
|
515
|
-
```sass
|
516
|
-
weight($weight)
|
255
|
+
bold: 700,
|
256
|
+
normal: 400,
|
257
|
+
lighter: 200
|
258
|
+
);
|
517
259
|
```
|
518
260
|
|
519
|
-
|
520
|
-
A weight from the $font-weight map.
|
521
|
-
|
522
|
-
*@return string*
|
523
|
-
The selected font-weight.
|
524
|
-
|
261
|
+
You can then use typey's built in `weight()` function to call these values in an easy and readable way.
|
525
262
|
|
526
263
|
```sass
|
527
|
-
|
264
|
+
strong {
|
265
|
+
font-weight: weight(bold)
|
266
|
+
}
|
528
267
|
```
|
529
268
|
|
530
|
-
|
531
|
-
$new-font-stack: extend-font-stack("Open sans", $sans-serif-stack);
|
532
|
-
|
533
|
-
*@param string $font*
|
534
|
-
The name of the font. Use inverted commas if there are spaces in the font name. i.e "Open sans"
|
269
|
+
## More examples
|
535
270
|
|
536
|
-
|
537
|
-
The font stack variable to extend.
|
271
|
+
Grab a copy of the source code (make sure you get the same version you have installed) and look in the examples folder for a few more hints.
|
538
272
|
|
539
|
-
|
540
|
-
|
541
|
-
Three standard do-all stacks.
|
542
|
-
|
543
|
-
```sass
|
544
|
-
$serif-stack: TimesNewRoman, "Times New Roman", Times, Baskerville, Georgia, serif;
|
545
|
-
$sans-serif-stack: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
546
|
-
$monospaced-stack: "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace;
|
547
|
-
```
|
548
|
-
|
549
|
-
Specific font stacks.
|
273
|
+
## Reference
|
550
274
|
|
551
|
-
|
552
|
-
$arial-stack: Arial, "Helvetica Neue", Helvetica, sans-serif;
|
553
|
-
$helvetica-stack: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
554
|
-
$baskerville-stack: Baskerville, "Baskerville Old Face", "Hoefler Text", Garamond, "Times New Roman", serif;
|
555
|
-
$monaco-stack: Monaco, Consolas, "Lucida Console", monospace;
|
556
|
-
$trebuchet-ms-stack: "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Tahoma, sans-serif;
|
557
|
-
```
|
275
|
+
The reference section has been removed for now in favour of the better detailed examples above. For explanation on all the individual functions and mixins inside typey you can just download the source code and ogle at the documentation contained within. Once the typey website launches it will include a complete reference section. Stay tuned.
|