Skip to content

Commit c55a187

Browse files
wilsongeQuyTonHLeithner
authored
[5.0] Add parameter for setting template link color in dark mode (#41925)
* Add parameter for setting template link color in dark mode * Update administrator/language/en-GB/tpl_atum.ini --------- Co-authored-by: Quy <[email protected]> Co-authored-by: Harald Leithner <[email protected]>
1 parent 1d137d5 commit c55a187

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

administrator/language/en-GB/tpl_atum.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ TPL_ATUM_BACKEND_LOGIN="Joomla Administrator Login"
99
TPL_ATUM_COLORS_HUE="Choose your hue value for the dark template colour"
1010
TPL_ATUM_COLORS_SETTINGS_BG_LIGHT_LABEL="Light Background"
1111
TPL_ATUM_COLORS_SETTINGS_LABEL="Colour Settings"
12+
TPL_ATUM_COLORS_SETTINGS_LINK_COLOR_DARK_LABEL="Link Colour (Dark Mode)"
1213
TPL_ATUM_COLORS_SETTINGS_LINK_COLOR_LABEL="Link Colour"
1314
TPL_ATUM_COLORS_SETTINGS_MONOCHROME_LABEL="Set Colour to Monochrome"
1415
TPL_ATUM_COLORS_SETTINGS_SPECIAL_COLOR_LABEL="Special Colour"

administrator/templates/atum/index.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
$linkColor = $this->params->get('link-color', '#2a69b8');
6565
list($r, $g, $b) = sscanf($linkColor, "#%02x%02x%02x");
6666

67+
$linkColorDark = $this->params->get('link-color-dark', '#7fa5d4');
68+
list($rd, $gd, $bd) = sscanf($linkColorDark, "#%02x%02x%02x");
69+
6770
// Enable assets
6871
$wa->usePreset('template.atum.' . ($this->direction === 'rtl' ? 'rtl' : 'ltr'))
6972
->useStyle('template.active.language')
@@ -76,7 +79,11 @@
7679
--link-color: ' . $linkColor . ';
7780
--link-color-rgb: ' . $r . ',' . $g . ',' . $b . ';
7881
--template-special-color: ' . $this->params->get('special-color', '#001B4C') . ';
79-
}');
82+
}')
83+
->addInlineStyle('@media (prefers-color-scheme: dark) { :root {
84+
--link-color: ' . $linkColorDark . ';
85+
--link-color-rgb: ' . $rd . ',' . $gd . ',' . $bd . ';
86+
}}');
8087

8188
// Override 'template.active' asset to set correct ltr/rtl dependency
8289
$wa->registerStyle('template.active', '', [], [], ['template.atum.' . ($this->direction === 'rtl' ? 'rtl' : 'ltr')]);

administrator/templates/atum/templateDetails.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@
8787
default="#2a69b8"
8888
filter="color"
8989
/>
90+
<field
91+
name="link-color-dark"
92+
type="color"
93+
label="TPL_ATUM_COLORS_SETTINGS_LINK_COLOR_DARK_LABEL"
94+
default="#7fa5d4"
95+
filter="color"
96+
/>
9097
<field
9198
name="special-color"
9299
type="color"

0 commit comments

Comments
 (0)