|
| 1 | +// |
| 2 | +// Copyright IBM Corp. 2018, 2018 |
| 3 | +// |
| 4 | +// This source code is licensed under the Apache-2.0 license found in the |
| 5 | +// LICENSE file in the root directory of this source tree. |
| 6 | +// |
| 7 | + |
| 8 | +/// Font family fallbacks for: IBM Plex Mono, IBM Plex Sans, IBM Plex Sans |
| 9 | +/// Condensed, IBM Plex Sans Hebrew, and IBM Plex Serif |
| 10 | +/// @type Map |
| 11 | +/// @access public |
| 12 | +/// @group @carbon/type |
| 13 | +$font-families: ( |
| 14 | + 'mono': |
| 15 | + unquote( |
| 16 | + "'IBM Plex Mono', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Courier, monospace" |
| 17 | + ), |
| 18 | + 'sans': unquote("'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif"), |
| 19 | + 'sans-condensed': |
| 20 | + unquote("'IBM Plex Sans Condensed', 'Helvetica Neue', Arial, sans-serif"), |
| 21 | + 'sans-hebrew': |
| 22 | + unquote( |
| 23 | + "'IBM Plex Sans Hebrew', 'Helvetica Hebrew', 'Arial Hebrew', sans-serif" |
| 24 | + ), |
| 25 | + 'serif': unquote("'IBM Plex Serif', 'Georgia', Times, serif"), |
| 26 | +) !default; |
| 27 | + |
| 28 | +/// Get the font-family for an IBM Plex font |
| 29 | +/// @param {String} $name |
| 30 | +/// @return {String} |
| 31 | +/// @access public |
| 32 | +/// @group @carbon/type |
| 33 | +@function font-family($name) { |
| 34 | + @return map-get($font-families, $name); |
| 35 | +} |
| 36 | + |
| 37 | +/// Include the `font-family` definition for the given name in your selector |
| 38 | +/// @param {String} $name |
| 39 | +/// @access public |
| 40 | +/// @group @carbon/type |
| 41 | +@mixin font-family($name) { |
| 42 | + font-family: font-family($name); |
| 43 | +} |
| 44 | + |
| 45 | +/// Suggested font weights to be used in product |
| 46 | +/// @type Map |
| 47 | +/// @access public |
| 48 | +/// @group @carbon/type |
| 49 | +$font-weights: ( |
| 50 | + 'light': 300, |
| 51 | + 'regular': 400, |
| 52 | + 'semibold': 600, |
| 53 | +) !default; |
| 54 | + |
| 55 | +/// Retrieve the font-weight value for a given name |
| 56 | +/// @param {String} $weight |
| 57 | +/// @return {Number} |
| 58 | +/// @access public |
| 59 | +/// @group @carbon/type |
| 60 | +@function font-weight($weight) { |
| 61 | + @return map-get($font-weights, $weight); |
| 62 | +} |
| 63 | + |
| 64 | +/// Set the `font-weight` property with the value for a given name |
| 65 | +/// @param {String} $weight |
| 66 | +/// @access public |
| 67 | +/// @group @carbon/type |
| 68 | +@mixin font-weight($weight) { |
| 69 | + font-weight: font-weight($weight); |
| 70 | +} |
0 commit comments