summaryrefslogtreecommitdiffstats
path: root/apps/theming
diff options
context:
space:
mode:
authorJulius Haertl <jus@bitgrid.net>2016-08-09 22:54:25 +0200
committerJulius Haertl <jus@bitgrid.net>2016-08-09 22:54:25 +0200
commitef17f8b3baf143b907ab4193f46221e39f84d381 (patch)
treede83ef7ae44f5c32c197455188b7fa1e1944c306 /apps/theming
parent5214b62d55b3907eb2da7c8e51a3c0c6cd09a00f (diff)
downloadnextcloud-server-ef17f8b3baf143b907ab4193f46221e39f84d381.tar.gz
nextcloud-server-ef17f8b3baf143b907ab4193f46221e39f84d381.zip
Add css classes to allow app developers using the theming colors
Diffstat (limited to 'apps/theming')
-rw-r--r--apps/theming/lib/Controller/ThemingController.php5
-rw-r--r--apps/theming/tests/Controller/ThemingControllerTest.php14
2 files changed, 19 insertions, 0 deletions
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index 8d9869b84a7..07bbee4323d 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -294,6 +294,8 @@ class ThemingController extends Controller {
color: ' . $color . ';
}
';
+ $responseCss .= sprintf('.nc-theming-main-background {background-color: %s}' . "\n", $color);
+ $responseCss .= sprintf('.nc-theming-main-text {color: %s}' . "\n", $color);
}
$logo = $this->config->getAppValue($this->appName, 'logoMime');
@@ -325,6 +327,9 @@ class ThemingController extends Controller {
$responseCss .= '#header .icon-caret { background-image: url(\'' . \OC::$WEBROOT . '/core/img/actions/caret-dark.svg\'); }' . "\n";
$responseCss .= '.searchbox input[type="search"] { background: transparent url(\'' . \OC::$WEBROOT . '/core/img/actions/search.svg\') no-repeat 6px center; color: #000; }' . "\n";
$responseCss .= '.searchbox input[type="search"]:focus,.searchbox input[type="search"]:active,.searchbox input[type="search"]:valid { color: #000; border: 1px solid rgba(0, 0, 0, .5); }' . "\n";
+ $responseCss .= '.nc-theming-contrast {color: #000000}' . "\n";
+ } else {
+ $responseCss .= '.nc-theming-contrast {color: #ffffff}' . "\n";
}
$response = new DataDownloadResponse($responseCss, 'style', 'text/css');
diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php
index 82eb8259af5..1129baafe44 100644
--- a/apps/theming/tests/Controller/ThemingControllerTest.php
+++ b/apps/theming/tests/Controller/ThemingControllerTest.php
@@ -392,6 +392,9 @@ class ThemingControllerTest extends TestCase {
color: ' . $color . ';
}
';
+ $expectedData .= sprintf('.nc-theming-main-background {background-color: %s}' . "\n", $color);
+ $expectedData .= sprintf('.nc-theming-main-text {color: %s}' . "\n", $color);
+ $expectedData .= '.nc-theming-contrast {color: #ffffff}' . "\n";
$expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
@@ -448,10 +451,13 @@ class ThemingControllerTest extends TestCase {
color: ' . $color . ';
}
';
+ $expectedData .= sprintf('.nc-theming-main-background {background-color: %s}' . "\n", $color);
+ $expectedData .= sprintf('.nc-theming-main-text {color: %s}' . "\n", $color);
$expectedData .= '#header .header-appname, #expandDisplayName { color: #000000; }' . "\n";
$expectedData .= '#header .icon-caret { background-image: url(\'' . \OC::$WEBROOT . '/core/img/actions/caret-dark.svg\'); }' . "\n";
$expectedData .= '.searchbox input[type="search"] { background: transparent url(\'' . \OC::$WEBROOT . '/core/img/actions/search.svg\') no-repeat 6px center; color: #000; }' . "\n";
$expectedData .= '.searchbox input[type="search"]:focus,.searchbox input[type="search"]:active,.searchbox input[type="search"]:valid { color: #000; border: 1px solid rgba(0, 0, 0, .5); }' . "\n";
+ $expectedData .= '.nc-theming-contrast {color: #000000}' . "\n";
$expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
@@ -495,6 +501,7 @@ class ThemingControllerTest extends TestCase {
'background-image: url(\'./logo?v=0\');' .
'background-size: contain;' .
'}' . "\n";
+ $expectedData .= '.nc-theming-contrast {color: #ffffff}' . "\n";
$expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
@@ -529,6 +536,7 @@ class ThemingControllerTest extends TestCase {
$expectedData .= '#firstrunwizard .firstrunwizard-header {' .
'background-image: url(\'./loginbackground?v=0\');' .
'}' . "\n";
+ $expectedData .= '.nc-theming-contrast {color: #ffffff}' . "\n";
$expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
@@ -585,6 +593,8 @@ class ThemingControllerTest extends TestCase {
color: ' . $color . ';
}
';
+ $expectedData .= sprintf('.nc-theming-main-background {background-color: %s}' . "\n", $color);
+ $expectedData .= sprintf('.nc-theming-main-text {color: %s}' . "\n", $color);
$expectedData .= sprintf(
'#header .logo {' .
'background-image: url(\'./logo?v=0\');' .
@@ -603,6 +613,7 @@ class ThemingControllerTest extends TestCase {
$expectedData .= '#firstrunwizard .firstrunwizard-header {' .
'background-image: url(\'./loginbackground?v=0\');' .
'}' . "\n";
+ $expectedData .= '.nc-theming-contrast {color: #ffffff}' . "\n";
$expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
$expected->cacheFor(3600);
@@ -658,6 +669,8 @@ class ThemingControllerTest extends TestCase {
color: ' . $color . ';
}
';
+ $expectedData .= sprintf('.nc-theming-main-background {background-color: %s}' . "\n", $color);
+ $expectedData .= sprintf('.nc-theming-main-text {color: %s}' . "\n", $color);
$expectedData .= sprintf(
'#header .logo {' .
'background-image: url(\'./logo?v=0\');' .
@@ -680,6 +693,7 @@ class ThemingControllerTest extends TestCase {
$expectedData .= '#header .icon-caret { background-image: url(\'' . \OC::$WEBROOT . '/core/img/actions/caret-dark.svg\'); }' . "\n";
$expectedData .= '.searchbox input[type="search"] { background: transparent url(\'' . \OC::$WEBROOT . '/core/img/actions/search.svg\') no-repeat 6px center; color: #000; }' . "\n";
$expectedData .= '.searchbox input[type="search"]:focus,.searchbox input[type="search"]:active,.searchbox input[type="search"]:valid { color: #000; border: 1px solid rgba(0, 0, 0, .5); }' . "\n";
+ $expectedData .= '.nc-theming-contrast {color: #000000}' . "\n";
$expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
$expected->cacheFor(3600);