diff --git a/apps/theming/lib/Capabilities.php b/apps/theming/lib/Capabilities.php
index 1b6bb8927be5bb08f2e003b58c3d7f6c89e39131..a75403a1fd583d73d54228012ade986c89e63401 100644
--- a/apps/theming/lib/Capabilities.php
+++ b/apps/theming/lib/Capabilities.php
@@ -81,6 +81,8 @@ class Capabilities implements IPublicCapability {
 				'background' => $backgroundLogo === 'backgroundColor' ?
 					$this->theming->getColorPrimary() :
 					$this->url->getAbsoluteURL($this->theming->getBackground()),
+				'background-plain' => $backgroundLogo === 'backgroundColor',
+				'background-default' => !$this->util->isBackgroundThemed(),
 			],
 		];
 	}
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index 05d387e627379447feeb5b3be217308583992654..9dcc981817e4220c36bc45ccc534bbc7c52d549b 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -196,22 +196,13 @@ class ThemingDefaults extends \OC_Defaults {
 	 * @return string
 	 */
 	public function getBackground() {
-		$backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime',false);
-
-		$backgroundExists = true;
-		try {
-			$this->appData->getFolder('images')->getFile('background');
-		} catch (\Exception $e) {
-			$backgroundExists = false;
-		}
-
 		$cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0');
 
-		if(!$backgroundLogo || !$backgroundExists) {
-			return $this->urlGenerator->imagePath('core','background.png') . '?v=' . $cacheBusterCounter;
+		if($this->util->isBackgroundThemed()) {
+			return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground') . '?v=' . $cacheBusterCounter;
 		}
 
-		return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground') . '?v=' . $cacheBusterCounter;
+		return $this->urlGenerator->imagePath('core','background.png') . '?v=' . $cacheBusterCounter;
 	}
 
 	/**
diff --git a/apps/theming/lib/Util.php b/apps/theming/lib/Util.php
index 6a1aa67210851051bc57a3d599849133e29bef34..2f6f41283650a2889ee29fdf78ff6f2f1598167a 100644
--- a/apps/theming/lib/Util.php
+++ b/apps/theming/lib/Util.php
@@ -235,4 +235,16 @@ class Util {
 		return false;
 	}
 
+	public function isBackgroundThemed() {
+		$backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime',false);
+
+		$backgroundExists = true;
+		try {
+			$this->appData->getFolder('images')->getFile('background');
+		} catch (\Exception $e) {
+			$backgroundExists = false;
+		}
+		return $backgroundLogo && $backgroundLogo !== 'backgroundColor' && $backgroundExists;
+	}
+
 }
diff --git a/apps/theming/tests/CapabilitiesTest.php b/apps/theming/tests/CapabilitiesTest.php
index c760c896425e0b713c088f77a3d97ebddca9b151..31e0ae799704a372c2847cb4f971d5be1e366186 100644
--- a/apps/theming/tests/CapabilitiesTest.php
+++ b/apps/theming/tests/CapabilitiesTest.php
@@ -50,6 +50,9 @@ class CapabilitiesTest extends TestCase  {
 	/** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
 	protected $config;
 
+	/** @var Util|\PHPUnit_Framework_MockObject_MockObject */
+	protected $util;
+
 	/** @var Capabilities */
 	protected $capabilities;
 
@@ -59,13 +62,13 @@ class CapabilitiesTest extends TestCase  {
 		$this->theming = $this->createMock(ThemingDefaults::class);
 		$this->url = $this->getMockBuilder(IURLGenerator::class)->getMock();
 		$this->config = $this->createMock(IConfig::class);
-		$util = new Util($this->config, $this->createMock(IAppManager::class), $this->createMock(IAppData::class));
-		$this->capabilities = new Capabilities($this->theming, $util, $this->url, $this->config);
+		$this->util = $this->createMock(Util::class);
+		$this->capabilities = new Capabilities($this->theming, $this->util, $this->url, $this->config);
 	}
 
 	public function dataGetCapabilities() {
 		return [
-			['name', 'url', 'slogan', '#FFFFFF', '#000000', 'logo', 'background', 'http://absolute/', [
+			['name', 'url', 'slogan', '#FFFFFF', '#000000', 'logo', 'background', 'http://absolute/', true, [
 				'name' => 'name',
 				'url' => 'url',
 				'slogan' => 'slogan',
@@ -74,8 +77,10 @@ class CapabilitiesTest extends TestCase  {
 				'color-element' => '#555555',
 				'logo' => 'http://absolute/logo',
 				'background' => 'http://absolute/background',
+				'background-plain' => false,
+				'background-default' => false,
 			]],
-			['name1', 'url2', 'slogan3', '#01e4a0', '#ffffff', 'logo5', 'background6', 'http://localhost/', [
+			['name1', 'url2', 'slogan3', '#01e4a0', '#ffffff', 'logo5', 'background6', 'http://localhost/', false, [
 				'name' => 'name1',
 				'url' => 'url2',
 				'slogan' => 'slogan3',
@@ -84,8 +89,22 @@ class CapabilitiesTest extends TestCase  {
 				'color-element' => '#01e4a0',
 				'logo' => 'http://localhost/logo5',
 				'background' => 'http://localhost/background6',
+				'background-plain' => false,
+				'background-default' => true,
+			]],
+			['name1', 'url2', 'slogan3', '#000000', '#ffffff', 'logo5', 'backgroundColor', 'http://localhost/', true, [
+				'name' => 'name1',
+				'url' => 'url2',
+				'slogan' => 'slogan3',
+				'color' => '#000000',
+				'color-text' => '#ffffff',
+				'color-element' => '#000000',
+				'logo' => 'http://localhost/logo5',
+				'background' => '#000000',
+				'background-plain' => true,
+				'background-default' => false,
 			]],
-			['name1', 'url2', 'slogan3', '#000000', '#ffffff', 'logo5', 'backgroundColor', 'http://localhost/', [
+			['name1', 'url2', 'slogan3', '#000000', '#ffffff', 'logo5', 'backgroundColor', 'http://localhost/', false, [
 				'name' => 'name1',
 				'url' => 'url2',
 				'slogan' => 'slogan3',
@@ -94,6 +113,8 @@ class CapabilitiesTest extends TestCase  {
 				'color-element' => '#000000',
 				'logo' => 'http://localhost/logo5',
 				'background' => '#000000',
+				'background-plain' => true,
+				'background-default' => true,
 			]],
 		];
 	}
@@ -104,13 +125,14 @@ class CapabilitiesTest extends TestCase  {
 	 * @param string $url
 	 * @param string $slogan
 	 * @param string $color
-	 * @param string $logo
 	 * @param string $textColor
+	 * @param string $logo
 	 * @param string $background
 	 * @param string $baseUrl
+	 * @param bool $backgroundThemed
 	 * @param string[] $expected
 	 */
-	public function testGetCapabilities($name, $url, $slogan, $color, $textColor, $logo, $background, $baseUrl, array $expected) {
+	public function testGetCapabilities($name, $url, $slogan, $color, $textColor, $logo, $background, $baseUrl, $backgroundThemed, array $expected) {
 		$this->config->expects($this->once())
 			->method('getAppValue')
 			->willReturn($background);
@@ -133,6 +155,16 @@ class CapabilitiesTest extends TestCase  {
 			->method('getTextColorPrimary')
 			->willReturn($textColor);
 
+		$util = new Util($this->config, $this->createMock(IAppManager::class), $this->createMock(IAppData::class));
+		$this->util->expects($this->once())
+			->method('elementColor')
+			->with($color)
+			->willReturn($util->elementColor($color));
+
+		$this->util->expects($this->once())
+			->method('isBackgroundThemed')
+			->willReturn($backgroundThemed);
+
 		if($background !== 'backgroundColor') {
 			$this->theming->expects($this->once())
 				->method('getBackground')
diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php
index 843c1d34f9e0f3033d4bf2f23ef48a9642e64ff0..d0dc6587f7418de400343b4d446373d678fefd69 100644
--- a/apps/theming/tests/ThemingDefaultsTest.php
+++ b/apps/theming/tests/ThemingDefaultsTest.php
@@ -391,24 +391,14 @@ class ThemingDefaultsTest extends TestCase {
 	}
 
 	public function testGetBackgroundDefault() {
-		$this->appData->expects($this->once())
-			->method('getFolder')
-			->willThrowException(new NotFoundException());
-		$this->config
-			->expects($this->at(0))
-			->method('getAppValue')
-			->with('theming', 'backgroundMime')
-			->willReturn('');
 		$this->config
-			->expects($this->at(1))
+			->expects($this->once())
 			->method('getAppValue')
 			->with('theming', 'cachebuster', '0')
 			->willReturn('0');
-		$this->appData
-			->expects($this->once())
-			->method('getFolder')
-			->with('images')
-			->willThrowException(new \Exception());
+		$this->util->expects($this->once())
+			->method('isBackgroundThemed')
+			->willReturn(false);
 		$this->urlGenerator->expects($this->once())
 			->method('imagePath')
 			->with('core', 'background.png')
@@ -417,24 +407,14 @@ class ThemingDefaultsTest extends TestCase {
 	}
 
 	public function testGetBackgroundCustom() {
-		$folder = $this->createMock(ISimpleFolder::class);
-		$file = $this->createMock(ISimpleFile::class);
-		$folder->expects($this->once())
-			->method('getFile')
-			->willReturn($file);
-		$this->appData->expects($this->once())
-			->method('getFolder')
-			->willReturn($folder);
 		$this->config
-			->expects($this->at(0))
-			->method('getAppValue')
-			->with('theming', 'backgroundMime', false)
-			->willReturn('image/svg+xml');
-		$this->config
-			->expects($this->at(1))
+			->expects($this->once())
 			->method('getAppValue')
 			->with('theming', 'cachebuster', '0')
 			->willReturn('0');
+		$this->util->expects($this->once())
+			->method('isBackgroundThemed')
+			->willReturn(true);
 		$this->urlGenerator->expects($this->once())
 			->method('linkToRoute')
 			->with('theming.Theming.getLoginBackground')
@@ -513,12 +493,12 @@ class ThemingDefaultsTest extends TestCase {
 		$this->config->expects($this->at(2))->method('getAppValue')->with('theming', 'backgroundMime', false)->willReturn('jpeg');
 		$this->config->expects($this->at(3))->method('getAppValue')->with('theming', 'logoMime', false)->willReturn('jpeg');
 		$this->config->expects($this->at(4))->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('0');
-		$this->config->expects($this->at(5))->method('getAppValue')->with('theming', 'backgroundMime', false)->willReturn('jpeg');
-		$this->config->expects($this->at(6))->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('0');
-		$this->config->expects($this->at(7))->method('getAppValue')->with('theming', 'color', null)->willReturn($this->defaults->getColorPrimary());
+		$this->util->expects($this->once())->method('isBackgroundThemed')->willReturn(true);
+		$this->config->expects($this->at(5))->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('0');
+		$this->config->expects($this->at(6))->method('getAppValue')->with('theming', 'color', null)->willReturn($this->defaults->getColorPrimary());
+		$this->config->expects($this->at(7))->method('getAppValue')->with('theming', 'color', $this->defaults->getColorPrimary())->willReturn($this->defaults->getColorPrimary());
 		$this->config->expects($this->at(8))->method('getAppValue')->with('theming', 'color', $this->defaults->getColorPrimary())->willReturn($this->defaults->getColorPrimary());
 		$this->config->expects($this->at(9))->method('getAppValue')->with('theming', 'color', $this->defaults->getColorPrimary())->willReturn($this->defaults->getColorPrimary());
-		$this->config->expects($this->at(10))->method('getAppValue')->with('theming', 'color', $this->defaults->getColorPrimary())->willReturn($this->defaults->getColorPrimary());
 
 		$this->util->expects($this->any())->method('invertTextColor')->with($this->defaults->getColorPrimary())->willReturn(false);
 		$this->util->expects($this->any())->method('elementColor')->with($this->defaults->getColorPrimary())->willReturn('#aaaaaa');
diff --git a/apps/theming/tests/UtilTest.php b/apps/theming/tests/UtilTest.php
index 1ad77be72d5010cc1de678655c0e5ace3b2aa5c3..247bcbae0b2ed8a196ce9551928d73869a2bb08a 100644
--- a/apps/theming/tests/UtilTest.php
+++ b/apps/theming/tests/UtilTest.php
@@ -189,7 +189,6 @@ class UtilTest extends TestCase {
 	}
 
 	public function testIsAlreadyThemedFalse() {
-		$theme = $this->config->getSystemValue('theme', '');
 		$this->config->expects($this->once())
 			->method('getSystemValue')
 			->with('theme', '')
@@ -199,7 +198,6 @@ class UtilTest extends TestCase {
 	}
 
 	public function testIsAlreadyThemedTrue() {
-		$theme = $this->config->getSystemValue('theme', '');
 		$this->config->expects($this->once())
 			->method('getSystemValue')
 			->with('theme', '')
@@ -208,4 +206,35 @@ class UtilTest extends TestCase {
 		$this->assertTrue($actual);
 	}
 
+	public function dataIsBackgroundThemed() {
+		return [
+			[false, false, false],
+			['png', true, true],
+			['backgroundColor', false, false],
+		];
+	}
+	/**
+	 * @dataProvider dataIsBackgroundThemed
+	 */
+	public function testIsBackgroundThemed($backgroundMime, $fileFound, $expected) {
+		$this->config->expects($this->once())
+			->method('getAppValue')
+			->with('theming', 'backgroundMime', false)
+			->willReturn($backgroundMime);
+		$folder = $this->createMock(ISimpleFolder::class);
+		if ($fileFound) {
+			$folder->expects($this->once())
+				->method('getFile')
+				->willReturn($this->createMock(ISimpleFile::class));
+		} else {
+			$folder->expects($this->once())
+				->method('getFile')
+				->willThrowException(new NotFoundException());
+		}
+		$this->appData->expects($this->once())
+			->method('getFolder')
+			->willReturn($folder);
+		$this->assertEquals($expected, $this->util->isBackgroundThemed());
+	}
+
 }