1
0

functions.scss 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*!
  2. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-License-Identifier: AGPL-3.0-or-later
  4. */
  5. /**
  6. * @see core/src/icons.js
  7. */
  8. @function match-color-string($color) {
  9. @if $color == #000 {
  10. @return "dark";
  11. }
  12. @if $color == #fff {
  13. @return 'white';
  14. }
  15. @if $color == #FC0 {
  16. @return 'yellow';
  17. }
  18. @if $color == #e9322d {
  19. @return 'red';
  20. }
  21. @if $color == #eca700 {
  22. @return 'orange';
  23. }
  24. @if $color == #46ba61 {
  25. @return 'green';
  26. }
  27. @if $color == #969696 {
  28. @return 'grey';
  29. }
  30. @return $color;
  31. }
  32. /**
  33. * SVG COLOR API
  34. *
  35. * @param string $icon the icon filename
  36. * @param string $dir the icon folder within /core/img if $core or app name
  37. * @param string $color the desired color in hexadecimal
  38. * @param int $version the version of the file
  39. * @param bool [$core] search icon in core
  40. *
  41. * @returns A background image with the url to the set to the requested icon.
  42. */
  43. @mixin icon-color($icon, $dir, $color, $version: 1, $core: false) {
  44. $color: match-color-string($color);
  45. /* $dir is the app name, so we add this to the icon var to avoid conflicts between apps */
  46. $varName: "--icon-#{$icon}-#{$color}";
  47. background-image: var(#{$varName});
  48. }