diff --git a/src/component.php b/src/component.php index 6af9805..d3f8075 100644 --- a/src/component.php +++ b/src/component.php @@ -33,9 +33,9 @@ $document = $app->getDocument(); $wa = $document->getWebAssetManager(); // Template params -$params_LightColorName = (string) $this->params->get('colorLightName', 'colors_standard'); // colors_standard|colors_alternative|colors_custom +$params_LightColorName = (string) $this->params->get('colorLightName', 'standard'); // standard|alternative|custom -$params_DarkColorName = (string) $this->params->get('colorDarkName', 'colors_standard'); // colors_standard|colors_alternative|colors_custom +$params_DarkColorName = (string) $this->params->get('colorDarkName', 'standard'); // standard|alternative|custom $params_googletagmanager = $this->params->get('googletagmanager', false); $params_googletagmanagerid = $this->params->get('googletagmanagerid', null); diff --git a/src/error.php b/src/error.php index 60b674f..7b90439 100644 --- a/src/error.php +++ b/src/error.php @@ -29,9 +29,9 @@ $params = $this->params; $wa = $this->getWebAssetManager(); // Template params -$params_LightColorName = (string) $params->get('colorLightName', 'colors_standard'); // colors_standard|colors_alternative|colors_custom +$params_LightColorName = (string) $params->get('colorLightName', 'standard'); // standard|alternative|custom -$params_DarkColorName = (string) $params->get('colorDarkName', 'colors_standard'); // colors_standard|colors_alternative|colors_custom +$params_DarkColorName = (string) $params->get('colorDarkName', 'standard'); // standard|alternative|custom $params_googletagmanager = $params->get('googletagmanager', false); $params_googletagmanagerid = $params->get('googletagmanagerid', ''); @@ -66,14 +66,14 @@ $colorDarkKey = strtolower(preg_replace('/[^a-z0-9_.-]/i', '', $params_DarkColo $lightKey = 'template.light.' . $colorLightKey; $darkKey = 'template.dark.' . $colorDarkKey; try { - $wa->useStyle('template.light.colors_standard'); + $wa->useStyle('template.light.standard'); } catch (\Throwable $e) { - $wa->registerAndUseStyle('template.light.colors_standard', $templatePath . '/css/theme/light.standard.css'); + $wa->registerAndUseStyle('template.light.standard', $templatePath . '/css/theme/light.standard.css'); } try { - $wa->useStyle('template.dark.colors_standard'); + $wa->useStyle('template.dark.standard'); } catch (\Throwable $e) { - $wa->registerAndUseStyle('template.dark.colors_standard', $templatePath . '/css/theme/dark.standard.css'); + $wa->registerAndUseStyle('template.dark.standard', $templatePath . '/css/theme/dark.standard.css'); } try { $wa->useStyle($lightKey); diff --git a/src/index.php b/src/index.php index fdd1853..6008deb 100644 --- a/src/index.php +++ b/src/index.php @@ -45,9 +45,9 @@ $document = $app->getDocument(); $wa = $document->getWebAssetManager(); // Template params -$params_LightColorName = (string) $this->params->get('colorLightName', 'colors_standard'); // colors_standard|colors_alternative|colors_custom +$params_LightColorName = (string) $this->params->get('colorLightName', 'standard'); // standard|alternative|custom -$params_DarkColorName = (string) $this->params->get('colorDarkName', 'colors_standard'); // colors_standard|colors_alternative|colors_custom +$params_DarkColorName = (string) $this->params->get('colorDarkName', 'standard'); // standard|alternative|custom $params_googletagmanager = $this->params->get('googletagmanager', false); $params_googletagmanagerid = $this->params->get('googletagmanagerid', null); @@ -88,34 +88,20 @@ $templatePath = 'media/templates/site/mokocassiopeia'; // Core template CSS $wa->useStyle('template.base'); // css/template.css -// Color theme (light + optional dark) -$colorLightKey = strtolower(preg_replace('/[^a-z0-9_.-]/i', '', $params_LightColorName)); -$colorDarkKey = strtolower(preg_replace('/[^a-z0-9_.-]/i', '', $params_DarkColorName)); -$lightKey = 'template.light.' . $colorLightKey; -$darkKey = 'template.dark.' . $colorDarkKey; +// Theme palettes (light + dark) +// Always load standard theme, then load custom if selected +$wa->useStyle('template.light.standard'); +$wa->useStyle('template.dark.standard'); -try { - $wa->useStyle('template.light.colors_standard'); -} catch (\Throwable $e) { - $wa->registerAndUseStyle('template.light.colors_standard', $templatePath . '/css/theme/light.standard.css'); +// Load custom or alternative themes if selected +if ($params_LightColorName === 'custom') { + $wa->useStyle('template.light.custom'); } -try { - $wa->useStyle('template.dark.colors_standard'); -} catch (\Throwable $e) { - $wa->registerAndUseStyle('template.dark.colors_standard', $templatePath . '/css/theme/dark.standard.css'); -} - -try { - $wa->useStyle($lightKey); -} catch (\Throwable $e) { - $wa->registerAndUseStyle('template.light.dynamic', $templatePath . '/css/theme/light.' . $colorLightKey . '.css'); -} - -try { - $wa->useStyle($darkKey); -} catch (\Throwable $e) { - $wa->registerAndUseStyle('template.dark.dynamic', $templatePath . '/css/theme/dark.' . $colorDarkKey . '.css'); +if ($params_DarkColorName === 'custom') { + $wa->useStyle('template.dark.custom'); +} elseif ($params_DarkColorName === 'alternative') { + $wa->useStyle('template.dark.alternative'); } // Scripts diff --git a/src/joomla.asset.json b/src/joomla.asset.json index a084ce0..6aa68b7 100644 --- a/src/joomla.asset.json +++ b/src/joomla.asset.json @@ -65,13 +65,13 @@ "attributes": {"media": "all"} }, { - "name": "template.light.colors_standard", + "name": "template.light.standard", "type": "style", "uri": "media/templates/site/mokocassiopeia/css/theme/light.standard.css", "attributes": {"media": "all"} }, { - "name": "template.light.colors_standard.min", + "name": "template.light.standard.min", "type": "style", "uri": "media/templates/site/mokocassiopeia/css/theme/light.standard.min.css", "attributes": {"media": "all"} @@ -89,13 +89,13 @@ "attributes": {"media": "all"} }, { - "name": "template.dark.colors_standard", + "name": "template.dark.standard", "type": "style", "uri": "media/templates/site/mokocassiopeia/css/theme/dark.standard.css", "attributes": {"media": "all"} }, { - "name": "template.dark.colors_standard.min", + "name": "template.dark.standard.min", "type": "style", "uri": "media/templates/site/mokocassiopeia/css/theme/dark.standard.min.css", "attributes": {"media": "all"} diff --git a/src/templateDetails.xml b/src/templateDetails.xml index f29f11c..a843aa8 100644 --- a/src/templateDetails.xml +++ b/src/templateDetails.xml @@ -187,13 +187,13 @@ - - - + + + - - - + + +