jekyll-theme-foundation 0.1.0

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.
Files changed (137) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +48 -0
  4. data/_includes/google-analytics.html +8 -0
  5. data/_includes/head.html +17 -0
  6. data/_includes/scripts.html +4 -0
  7. data/_layouts/default.html +16 -0
  8. data/_layouts/home.html +5 -0
  9. data/_layouts/page.html +5 -0
  10. data/_layouts/post.html +5 -0
  11. data/_sass/_vendor/normalize-scss/sass/_normalize.scss +3 -0
  12. data/_sass/_vendor/normalize-scss/sass/normalize/_import-now.scss +11 -0
  13. data/_sass/_vendor/normalize-scss/sass/normalize/_normalize-mixin.scss +676 -0
  14. data/_sass/_vendor/normalize-scss/sass/normalize/_variables.scss +36 -0
  15. data/_sass/_vendor/normalize-scss/sass/normalize/_vertical-rhythm.scss +61 -0
  16. data/_sass/_vendor/sassy-lists/stylesheets/functions/_contain.scss +31 -0
  17. data/_sass/_vendor/sassy-lists/stylesheets/functions/_purge.scss +38 -0
  18. data/_sass/_vendor/sassy-lists/stylesheets/functions/_remove.scss +31 -0
  19. data/_sass/_vendor/sassy-lists/stylesheets/functions/_replace.scss +46 -0
  20. data/_sass/_vendor/sassy-lists/stylesheets/functions/_to-list.scss +27 -0
  21. data/_sass/_vendor/sassy-lists/stylesheets/helpers/_missing-dependencies.scss +25 -0
  22. data/_sass/_vendor/sassy-lists/stylesheets/helpers/_true.scss +13 -0
  23. data/_sass/assets/foundation-float.scss +5 -0
  24. data/_sass/assets/foundation-prototype.scss +3 -0
  25. data/_sass/assets/foundation-rtl.scss +5 -0
  26. data/_sass/assets/foundation.scss +3 -0
  27. data/_sass/jekyll-theme-foundation.scss +5 -0
  28. data/_sass/scss/_global.scss +249 -0
  29. data/_sass/scss/components/_accordion-menu.scss +171 -0
  30. data/_sass/scss/components/_accordion.scss +155 -0
  31. data/_sass/scss/components/_badge.scss +63 -0
  32. data/_sass/scss/components/_breadcrumbs.scss +117 -0
  33. data/_sass/scss/components/_button-group.scss +253 -0
  34. data/_sass/scss/components/_button.scss +385 -0
  35. data/_sass/scss/components/_callout.scss +106 -0
  36. data/_sass/scss/components/_card.scss +129 -0
  37. data/_sass/scss/components/_close-button.scss +102 -0
  38. data/_sass/scss/components/_drilldown.scss +142 -0
  39. data/_sass/scss/components/_dropdown-menu.scss +274 -0
  40. data/_sass/scss/components/_dropdown.scss +79 -0
  41. data/_sass/scss/components/_flex-video.scss +1 -0
  42. data/_sass/scss/components/_flex.scss +117 -0
  43. data/_sass/scss/components/_float.scss +27 -0
  44. data/_sass/scss/components/_label.scss +64 -0
  45. data/_sass/scss/components/_media-object.scss +114 -0
  46. data/_sass/scss/components/_menu-icon.scss +9 -0
  47. data/_sass/scss/components/_menu.scss +495 -0
  48. data/_sass/scss/components/_off-canvas.scss +506 -0
  49. data/_sass/scss/components/_orbit.scss +196 -0
  50. data/_sass/scss/components/_pagination.scss +193 -0
  51. data/_sass/scss/components/_progress-bar.scss +64 -0
  52. data/_sass/scss/components/_responsive-embed.scss +70 -0
  53. data/_sass/scss/components/_reveal.scss +180 -0
  54. data/_sass/scss/components/_slider.scss +137 -0
  55. data/_sass/scss/components/_sticky.scss +39 -0
  56. data/_sass/scss/components/_switch.scss +247 -0
  57. data/_sass/scss/components/_table.scss +330 -0
  58. data/_sass/scss/components/_tabs.scss +196 -0
  59. data/_sass/scss/components/_thumbnail.scss +67 -0
  60. data/_sass/scss/components/_title-bar.scss +84 -0
  61. data/_sass/scss/components/_tooltip.scss +160 -0
  62. data/_sass/scss/components/_top-bar.scss +175 -0
  63. data/_sass/scss/components/_visibility.scss +132 -0
  64. data/_sass/scss/forms/_checkbox.scss +41 -0
  65. data/_sass/scss/forms/_error.scss +88 -0
  66. data/_sass/scss/forms/_fieldset.scss +53 -0
  67. data/_sass/scss/forms/_forms.scss +34 -0
  68. data/_sass/scss/forms/_help-text.scss +30 -0
  69. data/_sass/scss/forms/_input-group.scss +142 -0
  70. data/_sass/scss/forms/_label.scss +50 -0
  71. data/_sass/scss/forms/_meter.scss +116 -0
  72. data/_sass/scss/forms/_progress.scss +94 -0
  73. data/_sass/scss/forms/_range.scss +149 -0
  74. data/_sass/scss/forms/_select.scss +86 -0
  75. data/_sass/scss/forms/_text.scss +179 -0
  76. data/_sass/scss/foundation.scss +133 -0
  77. data/_sass/scss/grid/_classes.scss +176 -0
  78. data/_sass/scss/grid/_column.scss +112 -0
  79. data/_sass/scss/grid/_flex-grid.scss +259 -0
  80. data/_sass/scss/grid/_grid.scss +48 -0
  81. data/_sass/scss/grid/_gutter.scss +82 -0
  82. data/_sass/scss/grid/_layout.scss +76 -0
  83. data/_sass/scss/grid/_position.scss +76 -0
  84. data/_sass/scss/grid/_row.scss +99 -0
  85. data/_sass/scss/grid/_size.scss +24 -0
  86. data/_sass/scss/prototype/_arrow.scss +36 -0
  87. data/_sass/scss/prototype/_border-box.scss +35 -0
  88. data/_sass/scss/prototype/_border-none.scss +35 -0
  89. data/_sass/scss/prototype/_bordered.scss +54 -0
  90. data/_sass/scss/prototype/_box.scss +23 -0
  91. data/_sass/scss/prototype/_display.scss +50 -0
  92. data/_sass/scss/prototype/_font-styling.scss +95 -0
  93. data/_sass/scss/prototype/_list-style-type.scss +95 -0
  94. data/_sass/scss/prototype/_overflow.scss +72 -0
  95. data/_sass/scss/prototype/_position.scss +114 -0
  96. data/_sass/scss/prototype/_prototype.scss +87 -0
  97. data/_sass/scss/prototype/_relation.scss +157 -0
  98. data/_sass/scss/prototype/_rotate.scss +31 -0
  99. data/_sass/scss/prototype/_rounded.scss +54 -0
  100. data/_sass/scss/prototype/_separator.scss +96 -0
  101. data/_sass/scss/prototype/_shadow.scss +43 -0
  102. data/_sass/scss/prototype/_sizing.scss +73 -0
  103. data/_sass/scss/prototype/_spacing.scss +204 -0
  104. data/_sass/scss/prototype/_text-decoration.scss +48 -0
  105. data/_sass/scss/prototype/_text-transformation.scss +48 -0
  106. data/_sass/scss/prototype/_text-utilities.scss +88 -0
  107. data/_sass/scss/settings/_settings.scss +869 -0
  108. data/_sass/scss/typography/_alignment.scss +22 -0
  109. data/_sass/scss/typography/_base.scss +509 -0
  110. data/_sass/scss/typography/_helpers.scss +80 -0
  111. data/_sass/scss/typography/_print.scss +86 -0
  112. data/_sass/scss/typography/_typography.scss +26 -0
  113. data/_sass/scss/util/_breakpoint.scss +348 -0
  114. data/_sass/scss/util/_color.scss +129 -0
  115. data/_sass/scss/util/_direction.scss +31 -0
  116. data/_sass/scss/util/_flex.scss +85 -0
  117. data/_sass/scss/util/_math.scss +72 -0
  118. data/_sass/scss/util/_mixins.scss +313 -0
  119. data/_sass/scss/util/_selector.scss +41 -0
  120. data/_sass/scss/util/_typography.scss +26 -0
  121. data/_sass/scss/util/_unit.scss +152 -0
  122. data/_sass/scss/util/_util.scss +14 -0
  123. data/_sass/scss/util/_value.scss +160 -0
  124. data/_sass/scss/xy-grid/_cell.scss +169 -0
  125. data/_sass/scss/xy-grid/_classes.scss +476 -0
  126. data/_sass/scss/xy-grid/_collapse.scss +74 -0
  127. data/_sass/scss/xy-grid/_frame.scss +85 -0
  128. data/_sass/scss/xy-grid/_grid.scss +35 -0
  129. data/_sass/scss/xy-grid/_gutters.scss +45 -0
  130. data/_sass/scss/xy-grid/_layout.scss +33 -0
  131. data/_sass/scss/xy-grid/_position.scss +28 -0
  132. data/_sass/scss/xy-grid/_xy-grid.scss +51 -0
  133. data/assets/css/main.scss +5 -0
  134. data/assets/css/motion-ui.min.css +1 -0
  135. data/assets/js/foundation.min.js +5 -0
  136. data/assets/js/motion-ui.min.js +1 -0
  137. metadata +235 -0
@@ -0,0 +1,26 @@
1
+ // Foundation for Sites by ZURB
2
+ // foundation.zurb.com
3
+ // Licensed under MIT Open Source
4
+
5
+ ////
6
+ /// @group typography
7
+ ////
8
+
9
+ // Base typography styles (tags only)
10
+ @import 'base';
11
+
12
+ // Typography helper classes (classes only)
13
+ @import 'helpers';
14
+
15
+ // Text alignment classes
16
+ @import 'alignment';
17
+
18
+ // Print styles
19
+ @import 'print';
20
+
21
+ @mixin foundation-typography {
22
+ @include foundation-typography-base;
23
+ @include foundation-typography-helpers;
24
+ @include foundation-text-alignment;
25
+ @include foundation-print-styles;
26
+ }
@@ -0,0 +1,348 @@
1
+ // Foundation for Sites by ZURB
2
+ // foundation.zurb.com
3
+ // Licensed under MIT Open Source
4
+
5
+ ////
6
+ /// @group breakpoints
7
+ ////
8
+
9
+ /// A list of named breakpoints. You can use these with the `breakpoint()` mixin to quickly create media queries.
10
+ /// @type Map
11
+ $breakpoints: (
12
+ small: 0,
13
+ medium: 640px,
14
+ large: 1024px,
15
+ xlarge: 1200px,
16
+ xxlarge: 1440px,
17
+ ) !default;
18
+
19
+ /// The largest named breakpoint in which to include print as a media type
20
+ /// @type Keyword
21
+ $print-breakpoint: large !default;
22
+
23
+ $-zf-zero-breakpoint: small !default;
24
+
25
+ $-zf-breakpoints-keys: map-to-list($breakpoints, 'keys');
26
+
27
+ @if nth(map-values($breakpoints), 1) != 0 {
28
+ @error 'Your smallest breakpoint (defined in $breakpoints) must be set to "0".';
29
+ }
30
+ @else {
31
+ $-zf-zero-breakpoint: nth(map-keys($breakpoints), 1);
32
+ }
33
+
34
+ /// All of the names in this list will be output as classes in your CSS, like `.small-12`, `.medium-6`, and so on. Each value in this list must also be in the `$breakpoints` map.
35
+ /// @type List
36
+ $breakpoint-classes: (small medium large) !default;
37
+
38
+ /// Generates a media query string matching the input value. Refer to the documentation for the `breakpoint()` mixin to see what the possible inputs are.
39
+ ///
40
+ /// @param {Keyword|Number} $val [small] - Breakpoint name, or px, rem, or em value to process.
41
+ @function breakpoint($val: $-zf-zero-breakpoint) {
42
+ // Size or keyword
43
+ $bp: nth($val, 1);
44
+ // Value for max-width media queries
45
+ $bp-max: 0;
46
+ // Direction of media query (up, down, or only)
47
+ $dir: if(length($val) > 1, nth($val, 2), up);
48
+ // Eventual output
49
+ $str: '';
50
+ // Is it a named media query?
51
+ $named: false;
52
+
53
+ // Orientation media queries have a unique syntax
54
+ @if $bp == 'landscape' or $bp == 'portrait' {
55
+ @return '(orientation: #{$bp})';
56
+ }
57
+ @else if $bp == 'retina' {
58
+ @return '(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)';
59
+ }
60
+
61
+ // Try to pull a named breakpoint out of the $breakpoints map
62
+ @if type-of($bp) == 'string' {
63
+ @if map-has-key($breakpoints, $bp) {
64
+ @if $dir == 'only' or $dir == 'down' {
65
+ $bp-max: -zf-map-next($breakpoints, $bp);
66
+ }
67
+
68
+ $bp: map-get($breakpoints, $bp);
69
+ $named: true;
70
+ }
71
+ @else {
72
+ $bp: 0;
73
+ @warn 'breakpoint(): "#{$val}" is not defined in your $breakpoints setting.';
74
+ }
75
+ }
76
+
77
+ // Convert any pixel, rem, or unitless value to em
78
+ $bp: -zf-bp-to-em($bp);
79
+ @if $bp-max {
80
+ $bp-max: -zf-bp-to-em($bp-max) - (1/16);
81
+ }
82
+
83
+ // Conditions to skip media query creation
84
+ // - It's a named breakpoint that resolved to "0 down" or "0 up"
85
+ // - It's a numeric breakpoint that resolved to "0 " + anything
86
+ @if $bp > 0em or $dir == 'only' or $dir == 'down' {
87
+ // `only` ranges use the format `(min-width: n) and (max-width: n)`
88
+ @if $dir == 'only' {
89
+ // Only named media queries can have an "only" range
90
+ @if $named == true {
91
+ // Only use "min-width" if the floor is greater than 0
92
+ @if $bp > 0em {
93
+ $str: $str + '(min-width: #{$bp})';
94
+
95
+ // Only add "and" to the media query if there's a ceiling
96
+ @if $bp-max != null {
97
+ $str: $str + ' and ';
98
+ }
99
+ }
100
+
101
+ // Only use "max-width" if there's a ceiling
102
+ @if $bp-max != null {
103
+ $str: $str + '(max-width: #{$bp-max})';
104
+ }
105
+ }
106
+ @else {
107
+ @warn 'breakpoint(): Only named media queries can have an `only` range.';
108
+ }
109
+ }
110
+
111
+ // `down` ranges use the format `(max-width: n)`
112
+ @else if $dir == 'down' {
113
+ $max: if($named, $bp-max, $bp);
114
+
115
+ // Skip media query creation if input value is exactly "0 down",
116
+ // unless the function was called as "small down", in which case it's just "small only"
117
+ @if $named or $bp > 0em {
118
+ @if $max != null {
119
+ $str: $str + '(max-width: #{$max})';
120
+ }
121
+ }
122
+ }
123
+
124
+ // `up` ranges use the format `(min-width: n)`
125
+ @else if $bp > 0em {
126
+ $str: $str + '(min-width: #{$bp})';
127
+ }
128
+ }
129
+
130
+ @return $str;
131
+ }
132
+
133
+ /// Wraps a media query around the content you put inside the mixin. This mixin accepts a number of values:
134
+ /// - If a string is passed, the mixin will look for it in the `$breakpoints` map, and use a media query there.
135
+ /// - If a pixel value is passed, it will be converted to an em value using `$global-font-size` as the base.
136
+ /// - If a rem value is passed, the unit will be changed to em.
137
+ /// - If an em value is passed, the value will be used as-is.
138
+ ///
139
+ /// @param {Keyword|Number} $value - Breakpoint name, or px, rem, or em value to process.
140
+ ///
141
+ /// @output If the breakpoint is "0px and larger", outputs the content as-is. Otherwise, outputs the content wrapped in a media query.
142
+ @mixin breakpoint($value) {
143
+ $str: breakpoint($value);
144
+ $bp: index($-zf-breakpoints-keys, $value);
145
+ $pbp: index($-zf-breakpoints-keys, $print-breakpoint);
146
+
147
+ $old-zf-size: null;
148
+
149
+ // Make breakpoint size available as a variable
150
+ @if global-variable-exists(-zf-size) {
151
+ $old-zf-size: $-zf-size;
152
+ }
153
+ $-zf-size: nth($value, 1) !global; // get the first value to account for `only` and `down` keywords
154
+
155
+ // If $str is still an empty string, no media query is needed
156
+ @if $str == '' {
157
+ @content;
158
+ }
159
+
160
+ // Otherwise, wrap the content in a media query
161
+ @else {
162
+ // For named breakpoints less than or equal to $print-breakpoint, add print to the media types
163
+ @if $bp != null and $bp <= $pbp {
164
+ @media print, screen and #{$str} {
165
+ @content;
166
+ }
167
+ }
168
+ @else {
169
+ @media screen and #{$str} {
170
+ @content;
171
+ }
172
+ }
173
+ }
174
+
175
+ @if $old-zf-size != null {
176
+ // Restore the old breakpoint size
177
+ $-zf-size: $old-zf-size !global;
178
+ } @else {
179
+ $-zf-size: null !global;
180
+ }
181
+ }
182
+
183
+ /// Convers the breakpoints map to a URL-encoded string, like this: `key1=value1&key2=value2`. The value is then dropped into the CSS for a special `<meta>` tag, which is read by the Foundation JavaScript. This is how we transfer values from Sass to JavaScript, so they can be defined in one place.
184
+ /// @access private
185
+ ///
186
+ /// @param {Map} $map - Map to convert.
187
+ ///
188
+ /// @returns {String} A string containing the map's contents.
189
+ @function -zf-bp-serialize($map) {
190
+ $str: '';
191
+ @each $key, $value in $map {
192
+ $str: $str + $key + '=' + -zf-bp-to-em($value) + '&';
193
+ }
194
+ $str: str-slice($str, 1, -2);
195
+
196
+ @return $str;
197
+ }
198
+
199
+ /// Find the next key in a map.
200
+ /// @access private
201
+ ///
202
+ /// @param {Map} $map - Map to traverse.
203
+ /// @param {Mixed} $key - Key to use as a starting point.
204
+ ///
205
+ /// @returns {Mixed} The value for the key after `$key`, if `$key` was found. If `$key` was not found, or `$key` was the last value in the map, returns `null`.
206
+ @function -zf-map-next($map, $key) {
207
+
208
+ // Store the keys of the map as a list
209
+ $values: map-keys($map);
210
+
211
+ $i: 0;
212
+
213
+ // If the Key Exists, Get the index of the key within the map and add 1 to it for the next breakpoint in the map
214
+ @if (map-has-key($map, $key)) {
215
+ $i: index($values, $key) + 1;
216
+ }
217
+
218
+ // If the key doesn't exist, or it's the last key in the map, return null
219
+ @if ($i > length($map) or $i == 0) {
220
+ @return null;
221
+ }
222
+ // Otherwise, return the value
223
+ @else {
224
+ @return map-get($map, nth($values, $i));
225
+ }
226
+
227
+ }
228
+
229
+ /// Return a list of our named breakpoints less than $key. Useful for dealing with
230
+ /// responsive gutters for the grid.
231
+ /// @access private
232
+ ///
233
+ /// @param {String} $key - Key to use as last breakpoint.
234
+ ///
235
+ /// @returns {Array} The list of breakpoints up to and. If $key is auto, returns breakpoints above the zero
236
+ @function -zf-breakpoints-less-than($key) {
237
+ $list: ();
238
+ $found_key: false;
239
+
240
+ @each $name in $-zf-breakpoints-keys {
241
+ @if ($name == $key) {
242
+ $found_key: true;
243
+ }
244
+ @if not $found_key {
245
+ $list: append($list, $name);
246
+ }
247
+ }
248
+ @return $list;
249
+ }
250
+
251
+ /// Return a list of our named breakpoints less than $key. Useful for dealing with
252
+ /// responsive gutters for the grid.
253
+ /// @access private
254
+ ///
255
+ /// @param {String} $breakpoing - a named or non-named breakpoing.
256
+ ///
257
+ /// @returns {Array} The list of breakpoints up to and. If $key is auto, returns breakpoints above the zero
258
+ @function -zf-closest-named-breakpoint($breakpoint) {
259
+ $last: $-zf-zero-breakpoint;
260
+ $found: false;
261
+
262
+ $value: unitless-calc($breakpoint, 1px);
263
+ @each $key, $val in $breakpoints {
264
+ @if not $found {
265
+ @if unitless-calc($val) > $value {
266
+ $found: true;
267
+ } @else {
268
+ $last: $key;
269
+ }
270
+ }
271
+ }
272
+
273
+ @return $last;
274
+ }
275
+
276
+ /// Get a value for a breakpoint from a responsive config map or single value.
277
+ /// - If the config is a single value, return it regardless of `$value`.
278
+ /// - If the config is a map and has the key `$value`, the exact breakpoint value is returned.
279
+ /// - If the config is a map and does *not* have the breakpoint, the value matching the next lowest breakpoint in the config map is returned.
280
+ /// @access private
281
+ ///
282
+ /// @param {Number|Map} $map - Responsive config map or single value.
283
+ /// @param {Keyword} $value - Breakpoint name to use.
284
+ ///
285
+ /// @return {Mixed} The corresponding breakpoint value.
286
+ @function -zf-get-bp-val($map, $value) {
287
+ // If the given map is a single value, return it
288
+ @if type-of($map) == 'number' {
289
+ @return $map;
290
+ }
291
+
292
+
293
+ // Check if the breakpoint name exists globally
294
+ @if not map-has-key($breakpoints, $value) {
295
+ @if type-of($value) == 'number' {
296
+ $value: -zf-closest-named-breakpoint($value);
297
+ } @else {
298
+ @return null;
299
+ }
300
+ }
301
+ // Check if the breakpoint name exists in the local config map
302
+ @else if map-has-key($map, $value) {
303
+ // If it does, just return the value
304
+ @return map-get($map, $value);
305
+ }
306
+ // Otherwise, find the next lowest breakpoint and return that value
307
+ @else {
308
+ $anchor: null;
309
+ $found: false;
310
+
311
+ @each $key, $val in $breakpoints {
312
+ @if not $found {
313
+ @if map-has-key($map, $key) {
314
+ $anchor: $key;
315
+ }
316
+ @if $key == $value {
317
+ $found: true;
318
+ }
319
+ }
320
+ }
321
+
322
+ @return map-get($map, $anchor);
323
+ }
324
+ }
325
+
326
+ @if map-has-key($breakpoints, small) {
327
+ $small-up: screen;
328
+ $small-only: unquote('screen and #{breakpoint(small only)}');
329
+ }
330
+
331
+ @if map-has-key($breakpoints, medium) {
332
+ $medium-up: unquote('screen and #{breakpoint(medium)}');
333
+ $medium-only: unquote('screen and #{breakpoint(medium only)}');
334
+ }
335
+
336
+ @if map-has-key($breakpoints, large) {
337
+ $large-up: unquote('screen and #{breakpoint(large)}');
338
+ $large-only: unquote('screen and #{breakpoint(large only)}');
339
+ }
340
+
341
+ @if map-has-key($breakpoints, xlarge) {
342
+ $xlarge-up: unquote('screen and #{breakpoint(xlarge)}');
343
+ $xlarge-only: unquote('screen and #{breakpoint(xlarge only)}');
344
+ }
345
+
346
+ @if map-has-key($breakpoints, xxlarge) {
347
+ $xxlarge-up: unquote('screen and #{breakpoint(xxlarge)}');
348
+ }
@@ -0,0 +1,129 @@
1
+ // Foundation for Sites by ZURB
2
+ // foundation.zurb.com
3
+ // Licensed under MIT Open Source
4
+
5
+ @import 'math';
6
+
7
+ $contrast-warnings: true !default;
8
+
9
+ ////
10
+ /// @group functions
11
+ ////
12
+
13
+ /// Checks the luminance of `$color`.
14
+ ///
15
+ /// @param {Color} $color - Color to check the luminance of.
16
+ ///
17
+ /// @returns {Number} The luminance of `$color`.
18
+ @function color-luminance($color) {
19
+ // Adapted from: https://github.com/LeaVerou/contrast-ratio/blob/gh-pages/color.js
20
+ // Formula: http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
21
+ $rgba: red($color), green($color), blue($color);
22
+ $rgba2: ();
23
+
24
+ @for $i from 1 through 3 {
25
+ $rgb: nth($rgba, $i);
26
+ $rgb: $rgb / 255;
27
+
28
+ $rgb: if($rgb < 0.03928, $rgb / 12.92, pow(($rgb + 0.055) / 1.055, 2.4));
29
+
30
+ $rgba2: append($rgba2, $rgb);
31
+ }
32
+
33
+ @return 0.2126 * nth($rgba2, 1) + 0.7152 * nth($rgba2, 2) + 0.0722 * nth($rgba2, 3);
34
+ }
35
+
36
+ /// Checks the contrast ratio of two colors.
37
+ ///
38
+ /// @param {Color} $color1 - First color to compare.
39
+ /// @param {Color} $color2 - Second color to compare.
40
+ ///
41
+ /// @returns {Number} The contrast ratio of the compared colors.
42
+ @function color-contrast($color1, $color2) {
43
+ // Adapted from: https://github.com/LeaVerou/contrast-ratio/blob/gh-pages/color.js
44
+ // Formula: http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
45
+ $luminance1: color-luminance($color1) + 0.05;
46
+ $luminance2: color-luminance($color2) + 0.05;
47
+ $ratio: $luminance1 / $luminance2;
48
+
49
+ @if $luminance2 > $luminance1 {
50
+ $ratio: 1 / $ratio;
51
+ }
52
+
53
+ $ratio: round($ratio * 10) / 10;
54
+
55
+ @return $ratio;
56
+ }
57
+
58
+ /// Checks the luminance of `$base`, and returns the color from `$colors` (list of colors) that has the most contrast.
59
+ ///
60
+ /// @param {Color} $base - Color to check luminance.
61
+ /// @param {List} $colors [($white, $black)] - Colors to compare.
62
+ /// @param {Number} $tolerance [$global-color-pick-contrast-tolerance] - Contrast tolerance.
63
+ ///
64
+ /// @returns {Color} the color from `$colors` (list of colors) that has the most contrast.
65
+ @function color-pick-contrast($base, $colors: ($white, $black), $tolerance: $global-color-pick-contrast-tolerance) {
66
+ $contrast: color-contrast($base, nth($colors, 1));
67
+ $best: nth($colors, 1);
68
+
69
+ @for $i from 2 through length($colors) {
70
+ $current-contrast: color-contrast($base, nth($colors, $i));
71
+ @if ($current-contrast - $contrast > $tolerance) {
72
+ $contrast: color-contrast($base, nth($colors, $i));
73
+ $best: nth($colors, $i);
74
+ }
75
+ }
76
+
77
+ @if ($contrast-warnings and $contrast < 3) {
78
+ @warn "Contrast ratio of #{$best} on #{$base} is pretty bad, just #{$contrast}";
79
+ }
80
+
81
+ @return $best;
82
+ }
83
+
84
+ /// Scales a color to be darker if it's light, or lighter if it's dark. Use this function to tint a color appropriate to its lightness.
85
+ ///
86
+ /// @param {Color} $color - Color to scale.
87
+ /// @param {Percentage} $scale [5%] - Amount to scale up or down.
88
+ /// @param {Percentage} $threshold [40%] - Threshold of lightness to check against.
89
+ ///
90
+ /// @returns {Color} A scaled color.
91
+ @function smart-scale($color, $scale: 5%, $threshold: 40%) {
92
+ @if lightness($color) > $threshold {
93
+ $scale: -$scale;
94
+ }
95
+ @return scale-color($color, $lightness: $scale);
96
+ }
97
+
98
+ /// Get color from foundation-palette
99
+ ///
100
+ /// @param {key} color key from foundation-palette
101
+ ///
102
+ /// @returns {Color} color from foundation-palette
103
+ @function get-color($key) {
104
+ @if map-has-key($foundation-palette, $key) {
105
+ @return map-get($foundation-palette, $key);
106
+ }
107
+ @else {
108
+ @error 'given $key is not available in $foundation-palette';
109
+ }
110
+ }
111
+
112
+ /// Transfers the colors in the `$foundation-palette`map into variables, such as `$primary-color` and `$secondary-color`. Call this mixin below the Global section of your settings file to properly migrate your codebase.
113
+ @mixin add-foundation-colors() {
114
+ @if map-has-key($foundation-palette, primary) {
115
+ $primary-color: map-get($foundation-palette, primary) !global;
116
+ }
117
+ @if map-has-key($foundation-palette, secondary) {
118
+ $secondary-color: map-get($foundation-palette, secondary) !global;
119
+ }
120
+ @if map-has-key($foundation-palette, success) {
121
+ $success-color: map-get($foundation-palette, success) !global;
122
+ }
123
+ @if map-has-key($foundation-palette, warning) {
124
+ $warning-color: map-get($foundation-palette, warning) !global;
125
+ }
126
+ @if map-has-key($foundation-palette, alert) {
127
+ $alert-color: map-get($foundation-palette, alert) !global;
128
+ }
129
+ }
@@ -0,0 +1,31 @@
1
+ // Foundation for Sites by ZURB
2
+ // foundation.zurb.com
3
+ // Licensed under MIT Open Source
4
+
5
+ ////
6
+ /// @group functions
7
+ ////
8
+
9
+ /// Returns the opposite direction of $dir
10
+ ///
11
+ /// @param {Keyword} $dir - Used direction between "top", "right", "bottom" and "left".
12
+ /// @return {Keyword} Opposite direction of $dir
13
+ @function direction-opposite(
14
+ $dir
15
+ ) {
16
+ $dirs: (top, right, bottom, left);
17
+ $place: index($dirs, $dir);
18
+
19
+ @if $place == null {
20
+ @error 'direction-opposite: Invalid $dir parameter, expected a value from "#{$dirs}", found "#{$dir}".';
21
+ @return null;
22
+ }
23
+
24
+ // Calcul the opposite place in a circle, with a starting index of 1
25
+ $length: length($dirs);
26
+ $demi: $length / 2;
27
+ $opposite-place: (($place + $demi - 1) % $length) + 1;
28
+
29
+ @return nth($dirs, $opposite-place);
30
+ }
31
+
@@ -0,0 +1,85 @@
1
+ $-zf-flex-justify: (
2
+ 'left': flex-start,
3
+ 'right': flex-end,
4
+ 'center': center,
5
+ 'justify': space-between,
6
+ 'spaced': space-around,
7
+ );
8
+
9
+ $-zf-flex-align: (
10
+ 'top': flex-start,
11
+ 'bottom': flex-end,
12
+ 'middle': center,
13
+ 'stretch': stretch,
14
+ );
15
+
16
+ $-zf-flex-direction: (
17
+ 'row': row,
18
+ 'row-reverse': row-reverse,
19
+ 'column': column,
20
+ 'column-reverse': column-reverse,
21
+ );
22
+
23
+ /// Enables flexbox by adding `display: flex` to the element.
24
+ @mixin flex {
25
+ display: flex;
26
+ }
27
+
28
+ /// Horizontally or vertically aligns the items within a flex container.
29
+ ///
30
+ /// @param {Keyword} $x [null] - Horizontal alignment to use. Can be `left`, `right`, `center`, `justify`, or `spaced`. Or, set it to `null` (the default) to not set horizontal alignment.
31
+ /// @param {Keyword} $y [null] - Vertical alignment to use. Can be `top`, `bottom`, `middle`, or `stretch`. Or, set it to `null` (the default) to not set vertical alignment.
32
+ @mixin flex-align($x: null, $y: null) {
33
+ @if $x {
34
+ @if map-has-key($-zf-flex-justify, $x) {
35
+ $x: map-get($-zf-flex-justify, $x);
36
+ }
37
+ @else {
38
+ @warn 'flex-grid-row-align(): #{$x} is not a valid value for horizontal alignment. Use left, right, center, justify, or spaced.';
39
+ }
40
+ }
41
+
42
+ @if $y {
43
+ @if map-has-key($-zf-flex-align, $y) {
44
+ $y: map-get($-zf-flex-align, $y);
45
+ }
46
+ @else {
47
+ @warn 'flex-grid-row-align(): #{$y} is not a valid value for vertical alignment. Use top, bottom, middle, or stretch.';
48
+ }
49
+ }
50
+
51
+ justify-content: $x;
52
+ align-items: $y;
53
+ }
54
+
55
+ /// Vertically align a single column within a flex row. Apply this mixin to a flex column.
56
+ ///
57
+ /// @param {Keyword} $y [null] - Vertical alignment to use. Can be `top`, `bottom`, `middle`, or `stretch`. Or, set it to `null` (the default) to not set vertical alignment.
58
+ @mixin flex-align-self($y: null) {
59
+ @if $y {
60
+ @if map-has-key($-zf-flex-align, $y) {
61
+ $y: map-get($-zf-flex-align, $y);
62
+ }
63
+ @else {
64
+ @warn 'flex-grid-column-align(): #{$y} is not a valid value for alignment. Use top, bottom, middle, or stretch.';
65
+ }
66
+ }
67
+
68
+ align-self: $y;
69
+ }
70
+
71
+ /// Changes the source order of a flex child. Children with lower numbers appear first in the layout.
72
+ /// @param {Number} $order [0] - Order number to apply.
73
+ @mixin flex-order($order: 0) {
74
+ order: $order;
75
+ }
76
+
77
+ /// Change flex-direction
78
+ /// @param {Keyword} $direction [row] - Flex direction to use. Can be
79
+ /// - row (default): same as text direction
80
+ /// - row-reverse: opposite to text direction
81
+ /// - column: same as row but top to bottom
82
+ /// - column-reverse: same as row-reverse top to bottom
83
+ @mixin flex-direction($direction: row) {
84
+ flex-direction: $direction;
85
+ }
@@ -0,0 +1,72 @@
1
+ // Foundation for Sites by ZURB
2
+ // foundation.zurb.com
3
+ // Licensed under MIT Open Source
4
+
5
+ ////
6
+ /// @group functions
7
+ ////
8
+
9
+ /// Finds the greatest common divisor of two integers.
10
+ ///
11
+ /// @param {Number} $a - First number to compare.
12
+ /// @param {Number} $b - Second number to compare.
13
+ ///
14
+ /// @returns {Number} The greatest common divisor.
15
+ @function gcd($a, $b) {
16
+ // From: http://rosettacode.org/wiki/Greatest_common_divisor#JavaScript
17
+ @if ($b != 0) {
18
+ @return gcd($b, $a % $b);
19
+ }
20
+ @else {
21
+ @return abs($a);
22
+ }
23
+ }
24
+
25
+ /// Handles decimal exponents by trying to convert them into a fraction and then use a nth-root-algorithm for parts of the calculation
26
+ ///
27
+ /// @param {Number} $base - The base number.
28
+ /// @param {Number} $exponent - The exponent.
29
+ ///
30
+ /// @returns {Number} The product of the exponentiation.
31
+ @function pow($base, $exponent, $prec: 16) {
32
+ @if (floor($exponent) != $exponent) {
33
+ $prec2 : pow(10, $prec);
34
+ $exponent: round($exponent * $prec2);
35
+ $denominator: gcd($exponent, $prec2);
36
+ @return nth-root(pow($base, $exponent / $denominator), $prec2 / $denominator, $prec);
37
+ }
38
+
39
+ $value: $base;
40
+ @if $exponent > 1 {
41
+ @for $i from 2 through $exponent {
42
+ $value: $value * $base;
43
+ }
44
+ }
45
+ @else if $exponent < 1 {
46
+ @for $i from 0 through -$exponent {
47
+ $value: $value / $base;
48
+ }
49
+ }
50
+
51
+ @return $value;
52
+ }
53
+
54
+ @function nth-root($num, $n: 2, $prec: 12) {
55
+ // From: http://rosettacode.org/wiki/Nth_root#JavaScript
56
+ $x: 1;
57
+
58
+ @for $i from 0 through $prec {
59
+ $x: 1 / $n * (($n - 1) * $x + ($num / pow($x, $n - 1)));
60
+ }
61
+
62
+ @return $x;
63
+ }
64
+
65
+ /// Calculates the height as a percentage of the width for a given ratio.
66
+ /// @param {List} $ratio - Ratio to use to calculate the height, formatted as `x by y`.
67
+ /// @return {Number} A percentage value for the height relative to the width of a responsive container.
68
+ @function ratio-to-percentage($ratio) {
69
+ $w: nth($ratio, 1);
70
+ $h: nth($ratio, 3);
71
+ @return $h / $w * 100%;
72
+ }