2024-06-18 10:46:56 -04:00
|
|
|
/*!
|
2024-05-10 09:09:14 -04:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2018-06-29 10:10:53 -04:00
|
|
|
*/
|
2018-08-30 14:00:13 -04:00
|
|
|
|
|
|
|
|
/**
|
2022-05-10 10:47:48 -04:00
|
|
|
* @see core/src/icons.js
|
2018-08-30 14:00:13 -04:00
|
|
|
*/
|
2022-05-10 10:47:48 -04:00
|
|
|
@function match-color-string($color) {
|
|
|
|
|
@if $color == #000 {
|
|
|
|
|
@return "dark";
|
|
|
|
|
}
|
|
|
|
|
@if $color == #fff {
|
|
|
|
|
@return 'white';
|
|
|
|
|
}
|
|
|
|
|
@if $color == #FC0 {
|
|
|
|
|
@return 'yellow';
|
|
|
|
|
}
|
|
|
|
|
@if $color == #e9322d {
|
|
|
|
|
@return 'red';
|
|
|
|
|
}
|
|
|
|
|
@if $color == #eca700 {
|
|
|
|
|
@return 'orange';
|
2018-08-30 14:00:13 -04:00
|
|
|
}
|
2022-05-10 10:47:48 -04:00
|
|
|
@if $color == #46ba61 {
|
|
|
|
|
@return 'green';
|
|
|
|
|
}
|
|
|
|
|
@if $color == #969696 {
|
|
|
|
|
@return 'grey';
|
|
|
|
|
}
|
|
|
|
|
@return $color;
|
2018-08-30 14:00:13 -04:00
|
|
|
}
|
|
|
|
|
|
2018-06-29 10:10:53 -04:00
|
|
|
/**
|
|
|
|
|
* SVG COLOR API
|
2018-08-30 14:00:13 -04:00
|
|
|
*
|
2018-06-29 10:10:53 -04:00
|
|
|
* @param string $icon the icon filename
|
|
|
|
|
* @param string $dir the icon folder within /core/img if $core or app name
|
|
|
|
|
* @param string $color the desired color in hexadecimal
|
2018-07-09 05:34:48 -04:00
|
|
|
* @param int $version the version of the file
|
2018-06-29 10:10:53 -04:00
|
|
|
* @param bool [$core] search icon in core
|
|
|
|
|
*
|
2018-08-30 14:00:13 -04:00
|
|
|
* @returns A background image with the url to the set to the requested icon.
|
2018-06-29 10:10:53 -04:00
|
|
|
*/
|
2018-07-09 05:34:48 -04:00
|
|
|
@mixin icon-color($icon, $dir, $color, $version: 1, $core: false) {
|
2022-05-10 10:47:48 -04:00
|
|
|
$color: match-color-string($color);
|
2018-11-12 11:32:15 -05:00
|
|
|
/* $dir is the app name, so we add this to the icon var to avoid conflicts between apps */
|
2022-05-10 10:47:48 -04:00
|
|
|
$varName: "--icon-#{$icon}-#{$color}";
|
2018-07-03 07:23:22 -04:00
|
|
|
background-image: var(#{$varName});
|
2018-07-20 06:49:16 -04:00
|
|
|
}
|