+ add setting for compulsory dark theme (closes GH-70)

This commit is contained in:
maxpozdeev 2023-09-06 14:35:03 +03:00
parent bb0a102ceb
commit 9fb376d8b2
6 changed files with 12 additions and 8 deletions

View file

@ -5,9 +5,10 @@
/* Dark mode */
@media (prefers-color-scheme: dark) {
/* prefers-color-scheme media query value detected in js part */
html[data-appearance=dark],
html[data-appearance=system][data-system-appearance=dark] {
:root {
color-scheme: dark;
--color-bg: #151515;
@ -95,5 +96,5 @@
/*--svg-select: url(images/select-dark.svg);*/
--svg-select: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNCAxNCI+PHBvbHlsaW5lIHBvaW50cz0iMiA2LCA3IDExLCAxMiA2IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0iI2FhYSIgZmlsbD0ibm9uZSIvPjwvc3ZnPg==");
}
}

View file

@ -86,7 +86,7 @@ class Config
'markup' => array('default'=>'markdown', 'type'=>'s'),
# Appearance: system default or always light
'appearance' => array('default'=>'system', 'type'=>'s', 'options'=>array('system','light')),
'appearance' => array('default'=>'system', 'type'=>'s', 'options'=>array('system','light','dark')),
# Array of activated extensions
'extensions' => array('default'=>[], 'type'=>'a')

View file

@ -184,7 +184,8 @@
"set_showtime": "Show time",
"set_appearance": "Appearance",
"set_appearance_system": "Same as system",
"set_appearance_light": "Light theme",
"set_appearance_light": "Light",
"set_appearance_dark": "Dark",
"set_extensions": "Extensions",
"set_activate": "Activate",
"set_deactivate": "Deactivate",

View file

@ -185,6 +185,7 @@
"set_appearance": "Тема оформления",
"set_appearance_system": "Как в системе",
"set_appearance_light": "Светлая",
"set_appearance_dark": "Тёмная",
"set_extensions": "Дополнения",
"set_activate": "Активировать",
"set_deactivate": "Деактивировать",

View file

@ -12,7 +12,7 @@
<link rel="icon" type="image/gif" href="<?php mttinfo('theme_url'); ?>images/logo.gif">
<link rel="stylesheet" type="text/css" href="<?php mttinfo('theme_url'); ?>style.css?v=<?php mttinfo('version'); ?>" media="all">
<link rel="stylesheet" type="text/css" href="<?php mttinfo('theme_url'); ?>markdown.css?v=<?php mttinfo('version'); ?>" media="all">
<?php if (get_mttinfo('appearance') == 'system'): ?>
<?php if (in_array(get_mttinfo('appearance'), ['system','dark'])): ?>
<link rel="stylesheet" type="text/css" href="<?php mttinfo('theme_url'); ?>dark.css?v=<?php mttinfo('version'); ?>" media="screen">
<?php endif; ?>
<link rel="stylesheet" type="text/css" href="<?php mttinfo('theme_url'); ?>print.css?v=<?php mttinfo('version'); ?>" media="print">

View file

@ -368,8 +368,9 @@ header('Content-type:text/html; charset=utf-8');
<div class="tr">
<div class="th"><?php _e('set_appearance');?>:</div>
<div class="td">
<label><input type="radio" name="appearance" value="system" <?php if(_c('appearance') == 'system') echo 'checked="checked"'; ?> /> <?php _e('set_appearance_system');?></label> <br/>
<label><input type="radio" name="appearance" value="light" <?php if(_c('appearance') == 'light') echo 'checked="checked"'; ?> /> <?php _e('set_appearance_light');?></label>
<label><input type="radio" name="appearance" value="system" <?php if(_c('appearance') == 'system') echo 'checked="checked"'; ?> /> <?php _e('set_appearance_system');?></label> <br>
<label><input type="radio" name="appearance" value="light" <?php if(_c('appearance') == 'light') echo 'checked="checked"'; ?> /> <?php _e('set_appearance_light');?></label> <br>
<label><input type="radio" name="appearance" value="dark" <?php if(_c('appearance') == 'dark') echo 'checked="checked"'; ?> /> <?php _e('set_appearance_dark');?></label>
</div>
</div>