_panels.scss 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // Foundation by ZURB
  2. // foundation.zurb.com
  3. // Licensed under MIT Open Source
  4. @import "global";
  5. //
  6. // @variables
  7. //
  8. $include-html-panel-classes: $include-html-classes !default;
  9. // We use these to control the background and border styles
  10. $panel-bg: scale-color($white, $lightness: -5%) !default;
  11. $panel-border-style: solid !default;
  12. $panel-border-size: 1px !default;
  13. // We use this % to control how much we darken things on hover
  14. $panel-function-factor: -11% !default;
  15. $panel-border-color: scale-color($panel-bg, $lightness: $panel-function-factor) !default;
  16. // We use these to set default inner padding and bottom margin
  17. $panel-margin-bottom: rem-calc(20) !default;
  18. $panel-padding: rem-calc(20) !default;
  19. // We use these to set default font colors
  20. $panel-font-color: $oil !default;
  21. $panel-font-color-alt: $white !default;
  22. $panel-header-adjust: true !default;
  23. $callout-panel-link-color: $primary-color !default;
  24. $callout-panel-link-color-hover: scale-color($callout-panel-link-color, $lightness: -14%) !default;
  25. //
  26. // @mixins
  27. //
  28. // We use this mixin to create panels.
  29. // $bg - Sets the panel background color. Default: $panel-pg || scale-color($white, $lightness: -5%) !default
  30. // $padding - Sets the panel padding amount. Default: $panel-padding || rem-calc(20)
  31. // $adjust - Sets the font color based on the darkness of the bg & resets header line-heights for panels. Default: $panel-header-adjust || true
  32. @mixin panel($bg:$panel-bg, $padding:$panel-padding, $adjust:$panel-header-adjust) {
  33. @if $bg {
  34. $bg-lightness: lightness($bg);
  35. border-style: $panel-border-style;
  36. border-width: $panel-border-size;
  37. border-color: scale-color($bg, $lightness: $panel-function-factor);
  38. margin-bottom: $panel-margin-bottom;
  39. padding: $padding;
  40. background: $bg;
  41. @if $bg-lightness >= 50% { color: $panel-font-color; }
  42. @else { color: $panel-font-color-alt; }
  43. // Respect the padding, fool.
  44. &>:first-child { margin-top: 0; }
  45. &>:last-child { margin-bottom: 0; }
  46. @if $adjust {
  47. // We set the font color based on the darkness of the bg.
  48. @if $bg-lightness >= 50% {
  49. h1,h2,h3,h4,h5,h6,p,li,dl { color: $panel-font-color; }
  50. }
  51. @else {
  52. h1,h2,h3,h4,h5,h6,p,li,dl { color: $panel-font-color-alt; }
  53. }
  54. // reset header line-heights for panels
  55. h1,h2,h3,h4,h5,h6 {
  56. line-height: 1; margin-bottom: rem-calc(20) / 2;
  57. &.subheader { line-height: 1.4; }
  58. }
  59. }
  60. }
  61. }
  62. @include exports("panel") {
  63. @if $include-html-panel-classes {
  64. /* Panels */
  65. .panel { @include panel;
  66. &.callout {
  67. @include panel(scale-color($primary-color, $lightness: 94%));
  68. a:not(.button) {
  69. color: $callout-panel-link-color;
  70. &:hover,
  71. &:focus {
  72. color: $callout-panel-link-color-hover;
  73. }
  74. }
  75. }
  76. &.radius {
  77. @include radius;
  78. }
  79. }
  80. }
  81. }