Component.scss 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. * @class Global_CSS
  3. */
  4. /**
  5. * Adds a small text shadow (or highlight) to give the impression of beveled text.
  6. *
  7. * @param {string} $type Either shadow or highlight, decides whether to apply a light shadow or dark.
  8. */
  9. @mixin bevel-text($type: 'shadow') {
  10. @if $enable-highlights {
  11. @if $type == shadow {
  12. text-shadow: rgba(0,0,0,.5) 0 -1px 0;
  13. } @else {
  14. text-shadow: rgba(255,255,255,.25) 0 1px 0;
  15. }
  16. }
  17. }
  18. /**
  19. * Adds a small box shadow (or highlight) to give the impression of being beveled.
  20. *
  21. * @param {string} $type Either shadow or highlight, decides whether to apply a light shadow or dark.
  22. */
  23. @mixin bevel-box($type: 'light') {
  24. @if $enable-highlights {
  25. @if $type == shadow {
  26. @include st-box-shadow(rgba(#000, .5) 0 -1px 0);
  27. } @else {
  28. @include st-box-shadow(rgba(#fff, .35) 0 1px 0);
  29. }
  30. }
  31. }
  32. /**
  33. * Bevels the text based on its background.
  34. *
  35. * @param {color} $bg-color Background color of element.
  36. *
  37. * See {@link #bevel-text}.
  38. */
  39. @mixin bevel-by-background($bg-color) {
  40. @if (lightness($bg-color) > 50) {
  41. @include bevel-text(light);
  42. } @else {
  43. @include bevel-text;
  44. }
  45. }
  46. /**
  47. * Creates a background gradient for masked elements, based on the lightness of their background.
  48. *
  49. * @param {color} $bg-color Background color of element.
  50. * @param {percent} $contrast Contrast of the new gradient to its background.
  51. * @param {percent} $style Gradient style of the gradient.
  52. *
  53. * See background-gradient mixin.
  54. */
  55. @mixin mask-by-background(
  56. $bg-color,
  57. $contrast: 100%,
  58. $style: $base-background-gradient
  59. ) {
  60. @if (lightness($bg-color) > 50) {
  61. @include background-gradient(darken($bg-color, $contrast), $style);
  62. } @else {
  63. @include background-gradient(lighten($bg-color, $contrast), $style);
  64. }
  65. }