Skip to content

Commit

Permalink
#313: quickly hooking up dark mode detection on framework level, want…
Browse files Browse the repository at this point in the history
…ed to see it in action
  • Loading branch information
yiendos committed Jul 6, 2020
1 parent 99159bc commit 8af6cff
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions code/libraries/joomlatools/library/template/helper/ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,15 @@ public function styles($config = array())
$config->css_file = sprintf('%scss/%s.css', (empty($config->folder) ? '' : $config->folder.'/'), $config->file);
}

if ($config->css_file) {
$html .= '<ktml:style src="assets://'.$config->css_file.'" />';
if ($config->css_file)
{
$light = $config->css_file;
$dark = str_replace('admin.', 'admin-dark.', $config->css_file);

//$html .= ''
$html .= '<ktml:style src="assets://' . $light . '" />';
$html .= '<ktml:style src="assets://' . $light . '" media="(prefers-color-scheme: no-preference), (prefers-color-scheme: light)" />';
$html .= '<ktml:style src="assets://' . $dark . '" media="(prefers-color-scheme: dark)" />';
}

return $html;
Expand Down

0 comments on commit 8af6cff

Please sign in to comment.