summaryrefslogtreecommitdiffstats
path: root/core/css
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-10-08 10:33:22 +0200
committerGitHub <noreply@github.com>2018-10-08 10:33:22 +0200
commit7971ba5cc66201830e5b4b141d2478efa2257c75 (patch)
treeeb176aa378f22ce09be1e64742f23304d7e25de3 /core/css
parent75f4b7b1918f56afe18e1ec77d4e1f41ce776383 (diff)
parent044ab0cbecf46d537e892dfa4efd862182798291 (diff)
downloadnextcloud-server-7971ba5cc66201830e5b4b141d2478efa2257c75.tar.gz
nextcloud-server-7971ba5cc66201830e5b4b141d2478efa2257c75.zip
Merge pull request #10898 from nextcloud/feature/10684/default-logo-color-theme-colors
Switches the default logo color depending on the primary color
Diffstat (limited to 'core/css')
-rw-r--r--core/css/functions.scss52
-rw-r--r--core/css/guest.css2
2 files changed, 39 insertions, 15 deletions
diff --git a/core/css/functions.scss b/core/css/functions.scss
index 0815ba29ab6..5007c3bbe79 100644
--- a/core/css/functions.scss
+++ b/core/css/functions.scss
@@ -19,31 +19,55 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
+
+/**
+ * Removes the "#" from a color.
+ *
+ * @param string $color The color
+ * @return string The color without #
+ */
+@function remove-hash-from-color($color) {
+ $index: str-index(inspect($color), '#');
+ @if $index {
+ $color: str-slice(inspect($color), 2);
+ }
+ @return $color;
+}
+
+/**
+ * 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.
+ */
+@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}?v=#{$version}';
+ } @else {
+ @return '#{$webroot}/svg/#{$dir}/#{$icon}/#{$color}?v=#{$version}';
+ }
+}
+
/**
* SVG COLOR 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
*
- * @returns string the url to the svg api endpoint
+ * @returns A background image with the url to the set to the requested icon.
*/
@mixin icon-color($icon, $dir, $color, $version: 1, $core: false) {
- // remove # from color
- // inspect cast int to string
- $index: str-index(inspect($color), '#');
- @if $index {
- $color: str-slice(inspect($color), 2);
- }
+ $color: remove-hash-from-color($color);
$varName: "--icon-#{$icon}-#{$color}";
- @if $core {
- #{$varName}: url('#{$webroot}/svg/core/#{$dir}/#{$icon}/#{$color}?v=#{$version}');
- } @else {
- #{$varName}: url('#{$webroot}/svg/#{$dir}/#{$icon}/#{$color}?v=#{$version}');
- }
+ #{$varName}: url(icon-color-path($icon, $dir, $color, $version, $core));
background-image: var(#{$varName});
}
diff --git a/core/css/guest.css b/core/css/guest.css
index 200aeda3129..ca15fee1894 100644
--- a/core/css/guest.css
+++ b/core/css/guest.css
@@ -78,7 +78,7 @@ body {
}
#header .logo {
- background-image: url('../img/logo.svg?v=1');
+ background-image: url('../img/logo/logo.svg?v=1');
background-repeat: no-repeat;
background-size: 175px;
background-position: center;