_gradients.scss 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Gradients
  2. @mixin gradient-bg($color) {
  3. @if $enable-gradients {
  4. background: $color linear-gradient(180deg, mix($body-bg, $color, 15%), $color) repeat-x;
  5. } @else {
  6. background-color: $color;
  7. }
  8. }
  9. // Horizontal gradient, from left to right
  10. //
  11. // Creates two color stops, start and end, by specifying a color and position for each color stop.
  12. @mixin gradient-x($start-color: $gray-700, $end-color: $gray-800, $start-percent: 0%, $end-percent: 100%) {
  13. background-image: linear-gradient(to right, $start-color $start-percent, $end-color $end-percent);
  14. background-repeat: repeat-x;
  15. }
  16. // Vertical gradient, from top to bottom
  17. //
  18. // Creates two color stops, start and end, by specifying a color and position for each color stop.
  19. @mixin gradient-y($start-color: $gray-700, $end-color: $gray-800, $start-percent: 0%, $end-percent: 100%) {
  20. background-image: linear-gradient(to bottom, $start-color $start-percent, $end-color $end-percent);
  21. background-repeat: repeat-x;
  22. }
  23. @mixin gradient-directional($start-color: $gray-700, $end-color: $gray-800, $deg: 45deg) {
  24. background-image: linear-gradient($deg, $start-color, $end-color);
  25. background-repeat: repeat-x;
  26. }
  27. @mixin gradient-x-three-colors($start-color: $blue, $mid-color: $purple, $color-stop: 50%, $end-color: $red) {
  28. background-image: linear-gradient(to right, $start-color, $mid-color $color-stop, $end-color);
  29. background-repeat: no-repeat;
  30. }
  31. @mixin gradient-y-three-colors($start-color: $blue, $mid-color: $purple, $color-stop: 50%, $end-color: $red) {
  32. background-image: linear-gradient($start-color, $mid-color $color-stop, $end-color);
  33. background-repeat: no-repeat;
  34. }
  35. @mixin gradient-radial($inner-color: $gray-700, $outer-color: $gray-800) {
  36. background-image: radial-gradient(circle, $inner-color, $outer-color);
  37. background-repeat: no-repeat;
  38. }
  39. @mixin gradient-striped($color: rgba($white, .15), $angle: 45deg) {
  40. background-image: linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
  41. }