-
Notifications
You must be signed in to change notification settings - Fork 1
/
scale.scss
83 lines (77 loc) · 2.56 KB
/
scale.scss
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
@use 'lib/scale';
/*!
* Scale
*
* Global scale for (font) sizing and spacing.
*
* Size scale is designed to use for scaling text and icons.
* Space scale is designed to use for scaling margin, padding,
* gap or any other non-textual white space.
* Stroke scale is designed for borders, outline, underline etc.
*
* 400 is assumed to be default, similar to the normal font weight for text.
* The scale was designed based on this assumption, starting from 400
* and increasing it for the higher numbers, and decreasing for the lower ones.
*
* The naming convention intentionally presumes possibility
* to create intermediate options like `--size-450: 1.125rem;`
* but those are recommended be avoided unless necessary.
*
* The scale is crafted based on s=rⁿ formula, where:
* - `s` is the final size
* - `r` means ratio
* - `n` is an integer scale power
*
* For the scale below,
* - ratio was taken #{scale.$ratio},
* as the most optimal to produce small numbers;
* - powers are Fibonacci numbers between 1 and 13, including inverted;
* - afterwards, each result was shortened to precision=#{scale.$precision}
* to keep the numbers nice and short.
*
* Scale is made fluid and depended on the screen size
* starting growing from #{scale.$lower-clamp-point} width.
*/
:where(:root) {
--stroke-100: #{scale.value(-21)};
--stroke-200: #{scale.value(-13)};
--stroke-300: #{scale.value(-8)};
}
:where(:root) {
--space-100: #{scale.value(-8)};
--space-200: #{scale.value(-5)};
--space-300: #{scale.value(-2)};
--space-400: #{scale.value(0)};
--space-500: #{scale.value(2)};
--space-600: #{scale.range(scale.value(3), scale.value(5))};
--space-700: #{scale.range(scale.value(5), scale.value(8))};
--space-800: #{scale.range(scale.value(8), scale.value(13))};
--space-900: #{scale.range(scale.value(13), scale.value(21))};
}
@media print {
:root {
--space-600: #{scale.value(3)};
--space-700: #{scale.value(5)};
--space-800: #{scale.value(8)};
--space-900: #{scale.value(13)};
}
}
:where(:root) {
--size-100: #{scale.value(-3)};
--size-200: #{scale.value(-2)};
--size-300: #{scale.value(-1)};
--size-400: #{scale.value(0)};
--size-500: #{scale.value(1)};
--size-600: #{scale.range(scale.value(2), scale.value(3))};
--size-700: #{scale.range(scale.value(3), scale.value(5))};
--size-800: #{scale.range(scale.value(5), scale.value(8))};
--size-900: #{scale.range(scale.value(8), scale.value(13))};
}
@media print {
:root {
--size-600: #{scale.value(2)};
--size-700: #{scale.value(3)};
--size-800: #{scale.value(5)};
--size-900: #{scale.value(8)};
}
}