aboutsummaryrefslogtreecommitdiffstats
path: root/core/css/functions.scss
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2022-05-10 16:47:48 +0200
committerJohn Molakvoæ <skjnldsv@protonmail.com>2022-05-10 23:24:06 +0200
commitc59c3b5c1f8fba38d6b2e4bfd19714cb1f75ba85 (patch)
tree5ce2d8e17a8eb39f4493714a178a9164ad961840 /core/css/functions.scss
parentf0f2a07f850af1105e27be5bc9180500b1dbac39 (diff)
downloadnextcloud-server-c59c3b5c1f8fba38d6b2e4bfd19714cb1f75ba85.tar.gz
nextcloud-server-c59c3b5c1f8fba38d6b2e4bfd19714cb1f75ba85.zip
Migrate to static icons colours
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'core/css/functions.scss')
-rw-r--r--core/css/functions.scss64
1 files changed, 29 insertions, 35 deletions
diff --git a/core/css/functions.scss b/core/css/functions.scss
index 7489e574e97..3311ef06955 100644
--- a/core/css/functions.scss
+++ b/core/css/functions.scss
@@ -26,7 +26,7 @@
* @param string $color The color
* @return string The color without #
*/
-@function remove-hash-from-color($color) {
+ @function remove-hash-from-color($color) {
$color: unquote($color);
$index: str-index(inspect($color), '#');
@if $index {
@@ -36,22 +36,34 @@
}
/**
- * Calculates the URL to the svg under the SVG API.
- *
- * @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
- * @param int [$version] the version of the file
- * @param bool [$core] search icon in core
- * @return string The URL to the svg.
+ * @see core/src/icons.js
*/
-@function icon-color-path($icon, $dir, $color, $version: 1, $core: false) {
- $color: remove-hash-from-color($color);
- @if $core {
- @return '#{$webroot}/svg/core/#{$dir}/#{$icon}?color=#{$color}&v=#{$version}';
- } @else {
- @return '#{$webroot}/svg/#{$dir}/#{$icon}?color=#{$color}&v=#{$version}';
+@function match-color-string($color) {
+ @if $color == #000 {
+ @return "dark";
+ }
+ @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';
}
+ @if $color == #46ba61 {
+ @return 'green';
+ }
+ @if $color == #969696 {
+ @return 'grey';
+ }
+ @return $color;
}
/**
@@ -66,30 +78,12 @@
* @returns A background image with the url to the set to the requested icon.
*/
@mixin icon-color($icon, $dir, $color, $version: 1, $core: false) {
- $color: remove-hash-from-color($color);
+ $color: match-color-string($color);
/* $dir is the app name, so we add this to the icon var to avoid conflicts between apps */
- $varName: "--icon-#{$dir}-#{$icon}-#{$color}";
- @if $core {
- $varName: "--icon-#{$icon}-#{$color}";
- }
- #{$varName}: url(icon-color-path($icon, $dir, $color, $version, $core));
+ $varName: "--icon-#{$icon}-#{$color}";
background-image: var(#{$varName});
}
-/**
- * Create black and white icons
- * This will add a default black version of and an additional white version when .icon-white is applied
- */
-@mixin icon-black-white($icon, $dir, $version, $core: false) {
- .icon-#{$icon} {
- @include icon-color($icon, $dir, $color-black, $version, $core);
- }
- .icon-#{$icon}-white,
- .icon-#{$icon}.icon-white {
- @include icon-color($icon, $dir, $color-white, $version, $core);
- }
-}
-
@mixin position($value) {
@if $value == 'sticky' {
position: -webkit-sticky; // Safari support