Skip to content

Commit

Permalink
[5.0] Add parameter for setting template link color in dark mode (#41925
Browse files Browse the repository at this point in the history
)

* Add parameter for setting template link color in dark mode

* Update administrator/language/en-GB/tpl_atum.ini

---------

Co-authored-by: Quy <quy@nomonkeybiz.com>
Co-authored-by: Harald Leithner <leithner@itronic.at>
  • Loading branch information
3 people authored Sep 30, 2023
1 parent 1d137d5 commit c55a187
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions administrator/language/en-GB/tpl_atum.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ TPL_ATUM_BACKEND_LOGIN="Joomla Administrator Login"
TPL_ATUM_COLORS_HUE="Choose your hue value for the dark template colour"
TPL_ATUM_COLORS_SETTINGS_BG_LIGHT_LABEL="Light Background"
TPL_ATUM_COLORS_SETTINGS_LABEL="Colour Settings"
TPL_ATUM_COLORS_SETTINGS_LINK_COLOR_DARK_LABEL="Link Colour (Dark Mode)"
TPL_ATUM_COLORS_SETTINGS_LINK_COLOR_LABEL="Link Colour"
TPL_ATUM_COLORS_SETTINGS_MONOCHROME_LABEL="Set Colour to Monochrome"
TPL_ATUM_COLORS_SETTINGS_SPECIAL_COLOR_LABEL="Special Colour"
Expand Down
9 changes: 8 additions & 1 deletion administrator/templates/atum/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
$linkColor = $this->params->get('link-color', '#2a69b8');
list($r, $g, $b) = sscanf($linkColor, "#%02x%02x%02x");

$linkColorDark = $this->params->get('link-color-dark', '#7fa5d4');
list($rd, $gd, $bd) = sscanf($linkColorDark, "#%02x%02x%02x");

// Enable assets
$wa->usePreset('template.atum.' . ($this->direction === 'rtl' ? 'rtl' : 'ltr'))
->useStyle('template.active.language')
Expand All @@ -76,7 +79,11 @@
--link-color: ' . $linkColor . ';
--link-color-rgb: ' . $r . ',' . $g . ',' . $b . ';
--template-special-color: ' . $this->params->get('special-color', '#001B4C') . ';
}');
}')
->addInlineStyle('@media (prefers-color-scheme: dark) { :root {
--link-color: ' . $linkColorDark . ';
--link-color-rgb: ' . $rd . ',' . $gd . ',' . $bd . ';
}}');

// Override 'template.active' asset to set correct ltr/rtl dependency
$wa->registerStyle('template.active', '', [], [], ['template.atum.' . ($this->direction === 'rtl' ? 'rtl' : 'ltr')]);
Expand Down
7 changes: 7 additions & 0 deletions administrator/templates/atum/templateDetails.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@
default="#2a69b8"
filter="color"
/>
<field
name="link-color-dark"
type="color"
label="TPL_ATUM_COLORS_SETTINGS_LINK_COLOR_DARK_LABEL"
default="#7fa5d4"
filter="color"
/>
<field
name="special-color"
type="color"
Expand Down

0 comments on commit c55a187

Please sign in to comment.