_keystrokes.scss 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Foundation by ZURB
  2. // foundation.zurb.com
  3. // Licensed under MIT Open Source
  4. @import 'global';
  5. //
  6. // @variables
  7. //
  8. $include-html-keystroke-classes: $include-html-classes !default;
  9. // We use these to control text styles.
  10. $keystroke-font: "Consolas", "Menlo", "Courier", monospace !default;
  11. $keystroke-font-size: inherit !default;
  12. $keystroke-font-color: $jet !default;
  13. $keystroke-font-color-alt: $white !default;
  14. $keystroke-function-factor: -7% !default;
  15. // We use this to control keystroke padding.
  16. $keystroke-padding: rem-calc(2 4 0) !default;
  17. // We use these to control background and border styles.
  18. $keystroke-bg: scale-color($white, $lightness: $keystroke-function-factor) !default;
  19. $keystroke-border-style: solid !default;
  20. $keystroke-border-width: 1px !default;
  21. $keystroke-border-color: scale-color($keystroke-bg, $lightness: $keystroke-function-factor) !default;
  22. $keystroke-radius: $global-radius !default;
  23. //
  24. // @mixins
  25. //
  26. // We use this mixin to create keystroke styles.
  27. // $bg - Default: $keystroke-bg || scale-color($white, $lightness: $keystroke-function-factor) !default;
  28. @mixin keystroke($bg:$keystroke-bg) {
  29. // This find the lightness percentage of the background color.
  30. $bg-lightness: lightness($bg);
  31. background-color: $bg;
  32. border-color: scale-color($bg, $lightness: $keystroke-function-factor);
  33. // We adjust the font color based on the brightness of the background.
  34. @if $bg-lightness > 70% { color: $keystroke-font-color; }
  35. @else { color: $keystroke-font-color-alt; }
  36. border-style: $keystroke-border-style;
  37. border-width: $keystroke-border-width;
  38. font-family: $keystroke-font;
  39. font-size: $keystroke-font-size;
  40. margin: 0;
  41. padding: $keystroke-padding;
  42. }
  43. @include exports("keystroke") {
  44. @if $include-html-keystroke-classes {
  45. .keystroke,
  46. kbd {
  47. @include keystroke;
  48. @include radius($keystroke-radius);
  49. }
  50. }
  51. }