@@ -231,10 +231,10 @@ public function getColorPrimary(): string {
231231 $ themingBackground = $ this ->config ->getUserValue ($ user ->getUID (), Application::APP_ID , 'background ' , '' );
232232 // If the user selected the default background
233233 if ($ themingBackground === '' ) {
234- return BackgroundService:: DEFAULT_COLOR ;
234+ return $ defaultColor ;
235235 }
236236
237- // If the user selected a specific colour
237+ // If the user selected a valid custom colour
238238 if (preg_match ('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i ' , $ themingBackground )) {
239239 return $ themingBackground ;
240240 }
@@ -245,11 +245,6 @@ public function getColorPrimary(): string {
245245 }
246246 }
247247
248- // If the default color is not valid, return the default background one
249- if (!preg_match ('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i ' , $ defaultColor )) {
250- return BackgroundService::DEFAULT_COLOR ;
251- }
252-
253248 // Finally, return the system global primary color
254249 return $ defaultColor ;
255250 }
@@ -259,9 +254,12 @@ public function getColorPrimary(): string {
259254 */
260255 public function getDefaultColorPrimary (): string {
261256 $ color = $ this ->config ->getAppValue (Application::APP_ID , 'color ' );
257+
258+ // If the color is invalid, fallback to default
262259 if (!preg_match ('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i ' , $ color )) {
263- $ color = ' #0082c9 ' ;
260+ $ color = BackgroundService:: DEFAULT_COLOR ;
264261 }
262+
265263 return $ color ;
266264 }
267265
0 commit comments