_toasts.scss 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * Custom toast styles to reflect Bootstrap colors
  3. */
  4. /**
  5. * Get button close SVG.
  6. * Returns an either white or black button SVG dependent on the given color name.
  7. *
  8. * @param string $value - Bootstrap color name
  9. * @return string - Close button SVG URL
  10. */
  11. @function get-btn-close-svg($value) {
  12. @if $value == "primary" or $value == "secondary" or $value == "success" or $value == "danger" or $value == "dark" {
  13. @return "url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e\")";
  14. } @else {
  15. @return "url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e\")";
  16. }
  17. }
  18. //
  19. // Color variants
  20. //
  21. @each $name, $color in $theme-colors {
  22. .toast-#{$name} {
  23. --#{$prefix}toast-header-color: #{color-contrast($color)};
  24. --#{$prefix}toast-header-bg: #{$color};
  25. --#{$prefix}toast-header-border-color: #{$color};
  26. --#{$prefix}toast-border-color: #{$color};
  27. --#{$prefix}toast-bg: var(--#{$prefix}#{$name}-bg-subtle);
  28. }
  29. .toast-#{$name} .btn-close {
  30. --#{$prefix}btn-close-bg: #{get-btn-close-svg($name)};
  31. }
  32. }