_labels.scss 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // Foundation by ZURB
  2. // foundation.zurb.com
  3. // Licensed under MIT Open Source
  4. @import 'global';
  5. //
  6. // @variables
  7. //
  8. $include-html-label-classes: $include-html-classes !default;
  9. // We use these to style the labels
  10. $label-padding: rem-calc(4 8 4) !default;
  11. $label-radius: $global-radius !default;
  12. // We use these to style the label text
  13. $label-font-sizing: rem-calc(11) !default;
  14. $label-font-weight: $font-weight-normal !default;
  15. $label-font-color: $oil !default;
  16. $label-font-color-alt: $white !default;
  17. $label-font-family: $body-font-family !default;
  18. //
  19. // @mixins
  20. //
  21. // We use this mixin to create a default label base.
  22. @mixin label-base {
  23. display: inline-block;
  24. font-family: $label-font-family;
  25. font-weight: $label-font-weight;
  26. line-height: 1;
  27. margin-bottom: auto;
  28. position: relative;
  29. text-align: center;
  30. text-decoration: none;
  31. white-space: nowrap;
  32. }
  33. // @mixins
  34. //
  35. // We use this mixin to add label size styles.
  36. // $padding - Used to determine label padding. Default: $label-padding || rem-calc(4 8 4) !default
  37. // $text-size - Used to determine label text-size. Default: $text-size found in settings
  38. @mixin label-size($padding:$label-padding, $text-size:$label-font-sizing) {
  39. @if $padding { padding: $padding; }
  40. @if $text-size { font-size: $text-size; }
  41. }
  42. // @mixins
  43. //
  44. // We use this mixin to add label styles.
  45. // $bg - Default: $primary-color (found in settings file)
  46. // $radius - Default: false, Options: true, sets radius to $global-radius (found in settings file)
  47. @mixin label-style($bg:$primary-color, $radius:false) {
  48. // We control which background color comes through
  49. @if $bg {
  50. // This find the lightness percentage of the background color.
  51. $bg-lightness: lightness($bg);
  52. background-color: $bg;
  53. // We control the text color for you based on the background color.
  54. @if $bg-lightness < 70% { color: $label-font-color-alt; }
  55. @else { color: $label-font-color; }
  56. }
  57. // We use this to control the radius on labels.
  58. @if $radius == true { @include radius($label-radius); }
  59. @else if $radius { @include radius($radius); }
  60. }
  61. // @mixins
  62. //
  63. // We use this to add close buttons to alerts
  64. // $padding - Default: $label-padding,
  65. // $text-size - Default: $label-font-sizing,
  66. // $bg - Default: $primary-color(found in settings file)
  67. // $radius - Default: false, Options: true which sets radius to $global-radius (found in settings file)
  68. @mixin label($padding:$label-padding, $text-size:$label-font-sizing, $bg:$primary-color, $radius:false) {
  69. @include label-base;
  70. @include label-size($padding, $text-size);
  71. @include label-style($bg, $radius);
  72. }
  73. @include exports("label") {
  74. @if $include-html-label-classes {
  75. .label {
  76. @include label-base;
  77. @include label-size;
  78. @include label-style;
  79. &.radius { @include label-style(false, true); }
  80. &.round { @include label-style(false, $radius:1000px); }
  81. &.alert { @include label-style($alert-color); }
  82. &.warning { @include label-style($warning-color); }
  83. &.success { @include label-style($success-color); }
  84. &.secondary { @include label-style($secondary-color); }
  85. &.info { @include label-style($info-color); }
  86. }
  87. }
  88. }