| @@ -1,112 +1,37 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -use ThemeAtelier\Darkify\Includes\DarkifyUtils; | |
| 3 | +use ThemeAtelier\Darkify\Helpers\DarkifyUtils; | |
| 4 | 4 | |
| 5 | -// don't call the file directly. | |
| 6 | -if (!defined('ABSPATH')) { | |
| 7 | - exit; | |
| 8 | -} | |
| 9 | - | |
| 10 | 5 | ob_start(); |
| 11 | 6 | $options = get_option('darkify'); |
| 12 | -// Controls | |
| 13 | 7 | $enable_default_dark_mode = isset($options['enable_default_dark_mode']) ? $options['enable_default_dark_mode'] : ''; |
| 14 | 8 | $enable_os_aware = isset($options['enable_os_aware']) ? $options['enable_os_aware'] : true; |
| 15 | 9 | $enable_keyboard_shortcut = isset($options['enable_keyboard_shortcut']) ? $options['enable_keyboard_shortcut'] : true; |
| 16 | -$keyboard_shortcut_keys = isset($options['keyboard_shortcut_keys']) && $options['keyboard_shortcut_keys'] ? $options['keyboard_shortcut_keys'] : 'ctrl+alt+d'; | |
| 17 | 10 | $enable_time = isset($options['enable_time']) ? $options['enable_time'] : ""; |
| 18 | 11 | $enable_time_based_dark = isset($enable_time['enable_time_based_dark']) ? $enable_time['enable_time_based_dark'] : ""; |
| 19 | -$enable_time_fields = isset($enable_time['enable_time_fields']) ? $enable_time['enable_time_fields'] : ''; | |
| 20 | -$time_based_dark_start = isset($enable_time_fields['time_based_dark_start']) ? $enable_time_fields['time_based_dark_start'] : ""; | |
| 21 | -$time_based_dark_stop = isset($enable_time_fields['time_based_dark_end']) ? $enable_time_fields['time_based_dark_end'] : ""; | |
| 12 | +$time_based_dark_start = isset($enable_time['time_based_dark_start']['from']) ? $enable_time['time_based_dark_start']['from'] : ""; | |
| 13 | +$time_based_dark_stop = isset($enable_time['time_based_dark_start']['to']) ? $enable_time['time_based_dark_start']['to'] : ""; | |
| 22 | 14 | |
| 23 | 15 | // Extras |
| 24 | -$enable_scrollbar_dark = isset($options["enable_scrollbar_dark"]) ? $options["enable_scrollbar_dark"] : true; | |
| 25 | -$enable_frontend_iframe_dark_mode = isset($options['enable_frontend_iframe_dark_mode']) ? $options['enable_frontend_iframe_dark_mode'] : true; | |
| 26 | -$enable_switch_dragging = isset($options['enable_switch_dragging']) ? $options['enable_switch_dragging'] : ""; | |
| 27 | -$enable_switch_attention = isset($options['enable_switch_attention']) ? $options['enable_switch_attention'] : ''; | |
| 28 | -$switch_attention_effect = isset($options['switch_attention_effect']) ? $options['switch_attention_effect'] : 'pulse'; | |
| 29 | -$disallowed_elements = isset($options['disallowed_elements']) ? DarkifyUtils::normalize_restriction_class($options['disallowed_elements']) : ""; | |
| 30 | - | |
| 31 | -$disallowed_elements_force_to_correct = isset($options['disallowed_elements_force_to_correct']) ? $options['disallowed_elements_force_to_correct'] : true; | |
| 32 | -$allowed_elements_force_to_correct = isset($options['allowed_elements_force_to_correct']) ? $options['allowed_elements_force_to_correct'] : true; | |
| 33 | -$allowed_elements = isset($options['allowed_elements']) ? DarkifyUtils::normalize_restriction_class($options['allowed_elements']) : ""; | |
| 34 | - | |
| 16 | +$enable_scrollbar_dark = isset($options["enable_scrollbar_dark"]) ? $options["enable_scrollbar_dark"] : true; | |
| 35 | 17 | $alternative_dark_mode_switcher = isset($options['alternative_dark_mode_switcher']) ? $options['alternative_dark_mode_switcher'] : ""; |
| 36 | 18 | |
| 37 | - | |
| 38 | 19 | // Image Control |
| 39 | 20 | $brightness = isset($options['brightness']) ? $options['brightness'] : ""; |
| 40 | -$enable_low_image_brightness = isset($brightness['enable_low_image_brightness']) ? $brightness['enable_low_image_brightness'] : '1'; | |
| 21 | +$enable_low_image_brightness = isset($brightness['enable_low_image_brightness']) ? $brightness['enable_low_image_brightness'] : "1"; | |
| 41 | 22 | $low_image_brightness_label = isset($brightness['low_image_brightness_label']) ? 100 - $brightness['low_image_brightness_label'] : 100 - "20"; |
| 42 | -$disallowed_low_brightness_images = isset($brightness['disallowed_low_brightness_images']) ? DarkifyUtils::normalize_image_urls($brightness['disallowed_low_brightness_images']) : ""; | |
| 43 | 23 | |
| 44 | 24 | $grayscale = isset($options['grayscale']) ? $options['grayscale'] : ""; |
| 45 | 25 | $enable_image_grayscale = isset($grayscale['enable_image_grayscale']) ? $grayscale['enable_image_grayscale'] : ""; |
| 46 | 26 | $image_grayscale_label = isset($grayscale['image_grayscale_label']) ? $grayscale['image_grayscale_label'] : "80"; |
| 47 | -$disallowed_low_grayscale_images = isset($grayscale['disallowed_low_grayscale_images']) ? DarkifyUtils::normalize_image_urls($grayscale['disallowed_low_grayscale_images']) : ""; | |
| 48 | 27 | |
| 49 | 28 | $darken_background = isset($options['darken_background']) ? $options['darken_background'] : ""; |
| 50 | 29 | $enable_low_image_darken = isset($darken_background['enable_low_image_darken']) ? $darken_background['enable_low_image_darken'] : "1"; |
| 51 | -$low_image_darken_label = isset($darken_background['low_image_darken_label']) ? $darken_background['low_image_darken_label'] : '60'; | |
| 30 | +$low_image_darken_label = isset($darken_background['low_image_darken_label']) ? $darken_background['low_image_darken_label'] : "60"; | |
| 52 | 31 | |
| 53 | 32 | $enable_invert_inline_svg = isset($options['enable_invert_inline_svg']) ? $options['enable_invert_inline_svg'] : ""; |
| 54 | 33 | |
| 55 | -/* | |
| 56 | - * The override rows are printed into a <script> as raw JSON (like | |
| 57 | - * darkify_allowed_btn_class below), so each value is reduced to a known-safe | |
| 58 | - * shape here: a hex colour or one of the fixed scope keys. Rows missing either | |
| 59 | - * colour are dropped — a half-filled repeater row is the default state of the | |
| 60 | - * field and means nothing to the engine. | |
| 61 | - */ | |
| 62 | -$darkify_color_overrides = array(); | |
| 63 | -if (!empty($options['color_overrides']) && is_array($options['color_overrides'])) { | |
| 64 | - $darkify_override_scopes = array('all', 'text', 'icon', 'background', 'border', 'shadow'); | |
| 65 | - foreach ($options['color_overrides'] as $darkify_override_row) { | |
| 66 | - if (!is_array($darkify_override_row)) { | |
| 67 | - continue; | |
| 68 | - } | |
| 69 | - | |
| 70 | - $darkify_light = isset($darkify_override_row['light_color']) ? DarkifyUtils::sanitize_css_color($darkify_override_row['light_color']) : ''; | |
| 71 | - $darkify_dark = isset($darkify_override_row['dark_color']) ? DarkifyUtils::sanitize_css_color($darkify_override_row['dark_color']) : ''; | |
| 72 | - | |
| 73 | - if (!$darkify_light || !$darkify_dark) { | |
| 74 | - continue; | |
| 75 | - } | |
| 76 | - | |
| 77 | - $darkify_scope = isset($darkify_override_row['override_scope']) ? $darkify_override_row['override_scope'] : 'all'; | |
| 78 | - if (!in_array($darkify_scope, $darkify_override_scopes, true)) { | |
| 79 | - $darkify_scope = 'all'; | |
| 80 | - } | |
| 81 | - | |
| 82 | - $darkify_color_overrides[] = array( | |
| 83 | - 'light_color' => $darkify_light, | |
| 84 | - 'dark_color' => $darkify_dark, | |
| 85 | - 'override_scope' => $darkify_scope, | |
| 86 | - ); | |
| 87 | - } | |
| 88 | -} | |
| 89 | - | |
| 90 | -$invert = isset($options['invert']) ? $options['invert'] : ""; | |
| 91 | -$enable_invert_images = isset($invert['enable_invert_images']) ? $invert['enable_invert_images'] : ""; | |
| 92 | -$invert_images_allowed_urls = !empty($invert['invert_images_allowed_urls']) ? DarkifyUtils::normalize_image_urls($invert['invert_images_allowed_urls']) : ""; | |
| 93 | - | |
| 94 | -if ($invert_images_allowed_urls !== "") { | |
| 95 | - $invert_images_allowed_urls_explode = explode(',', $invert_images_allowed_urls); | |
| 96 | - $invert_images_allowed_urls_arr = json_encode($invert_images_allowed_urls_explode); | |
| 97 | -} else { | |
| 98 | - $invert_images_allowed_urls_arr = "[]"; | |
| 99 | -} | |
| 100 | - | |
| 101 | -$normal_image_replacements = isset($options["image_replacements"][0]['normal_image']) ? $options["image_replacements"][0]['normal_image'] : ''; | |
| 102 | -$dark_image_replacements = isset($options["image_replacements"][0]['dark_image']) ? $options["image_replacements"][0]['dark_image'] : ''; | |
| 103 | -if ($normal_image_replacements || $dark_image_replacements) { | |
| 104 | - $image_replacements = json_encode($options["image_replacements"]); | |
| 105 | -} else { | |
| 106 | - $image_replacements = ""; | |
| 107 | -} | |
| 108 | - | |
| 109 | 34 | // Video Control |
| 110 | 35 | $video_brightness = isset($options['video_brightness']) ? $options['video_brightness'] : ""; |
| 111 | 36 | $enable_low_video_brightness = isset($video_brightness['enable_low_video_brightness']) ? $video_brightness['enable_low_video_brightness'] : true; |
| 112 | 37 | $low_video_brightness_label = isset($video_brightness['low_video_brightness_label']) ? 100 - $video_brightness['low_video_brightness_label'] : 100 - "20"; |
| @@ -114,17 +39,10 @@ | ||
| 114 | 39 | $video_grayscale = isset($options['video_grayscale']) ? $options['video_grayscale'] : ''; |
| 115 | 40 | $enable_video_grayscale = isset($video_grayscale['enable_video_grayscale']) ? $video_grayscale['enable_video_grayscale'] : ""; |
| 116 | 41 | $video_grayscale_label = isset($video_grayscale['video_grayscale_label']) ? $video_grayscale['video_grayscale_label'] : "80"; |
| 117 | 42 | |
| 118 | -$normal_video_replacements = isset($options["video_replacements"][0]["normal_video"]) ? $options["video_replacements"][0]["normal_video"] : ''; | |
| 119 | -$dark_video_replacements = isset($options["video_replacements"][0]["dark_video"]) ? $options["video_replacements"][0]["dark_video"] : ''; | |
| 120 | -if ($normal_video_replacements || $dark_video_replacements) { | |
| 121 | - $video_replacements = json_encode($options["video_replacements"]); | |
| 122 | -} else { | |
| 123 | - $video_replacements = "[]"; | |
| 124 | -} | |
| 43 | + | |
| 125 | 44 | if (!is_admin()) { ?> |
| 126 | - <script type="text/javascript" class="darkify_inline_js">(function(){var s=localStorage.darkify_last_state,t=localStorage.darkify_selected_theme||'set1';if(s==='1'){var h=document.documentElement;h.classList.add('darkify_dark_mode_enabled');h.classList.add('darkify-'+t);h.classList.add('darkify_prepaint');setTimeout(function(){h.classList.remove('darkify_prepaint')},800);}}());</script> | |
| 127 | 45 | <style type="text/css" class="darkify_inline_css"> |
| 128 | 46 | :root { |
| 129 | 47 | <?php |
| 130 | 48 | $dark_mode_color_palettes = [ |
| @@ -130,194 +48,83 @@ | ||
| 130 | 48 | $dark_mode_color_palettes = [ |
| 131 | 49 | 'set1' => [ |
| 132 | 50 | 'bg' => isset($options["dark_mode_color_set1"]) ? $options["dark_mode_color_set1"]['background'] : '#0F0F0F', |
| 133 | 51 | 'secondary_bg' => isset($options["dark_mode_color_set1"]) ? $options["dark_mode_color_set1"]['secondary_background'] : '#171717', |
| 134 | - 'text_color' => isset($options["dark_mode_link_color_set1"]) ? $options["dark_mode_link_color_set1"]['text'] : '#BEBEBE', | |
| 135 | - 'link_color' => isset($options["dark_mode_link_color_set1"]) ? $options["dark_mode_link_color_set1"]['color'] : '#E7E7E7', | |
| 136 | - 'link_hover_color' => isset($options["dark_mode_link_color_set1"]) ? $options["dark_mode_link_color_set1"]['hover'] : '#BEBEBE', | |
| 137 | - 'input_bg' => isset($options["dark_mode_input_color_set1"]) ? $options["dark_mode_input_color_set1"]['background'] : '#2D2D2D', | |
| 138 | - 'input_text_color' => isset($options["dark_mode_input_color_set1"]) ? $options["dark_mode_input_color_set1"]['color'] : '#BEBEBE', | |
| 139 | - 'input_placeholder_color' => isset($options["dark_mode_input_color_set1"]) ? $options["dark_mode_input_color_set1"]['placeholder'] : '#BEBEBE', | |
| 140 | - 'border_color' => isset($options["dark_mode_border_color_set1"]) ? $options["dark_mode_border_color_set1"] : '#4A4A4A', | |
| 141 | - 'btn_text_color' => isset($options["dark_mode_btn_color_set1"]) ? $options["dark_mode_btn_color_set1"]['color'] : '#BEBEBE', | |
| 142 | - 'btn_bg' => isset($options["dark_mode_btn_color_set1"]) ? $options["dark_mode_btn_color_set1"]['background'] : '#4A4A4A', | |
| 143 | - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set1"]) ? $options["dark_mode_btn_color_set1"]['hover_color'] : '#BEBEBE', | |
| 144 | - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set1"]) ? $options["dark_mode_btn_color_set1"]['hover_background'] : '#2D2D2D', | |
| 145 | - 'btn_border_color' => isset($options["dark_mode_btn_color_set1"]['border']) ? $options["dark_mode_btn_color_set1"]['border'] : '#4A4A4A', | |
| 146 | - 'btn_hover_border_color' => isset($options["dark_mode_btn_color_set1"]['hover_border']) ? $options["dark_mode_btn_color_set1"]['hover_border'] : '#2D2D2D', | |
| 52 | + 'text_color' => '#BEBEBE', | |
| 53 | + 'link_color' => '#E7E7E7', | |
| 54 | + 'link_hover_color' => '#BEBEBE', | |
| 55 | + 'input_bg' => '#2D2D2D', | |
| 56 | + 'input_text_color' => '#BEBEBE', | |
| 57 | + 'input_placeholder_color' => '#BEBEBE', | |
| 58 | + 'border_color' => '#4A4A4A', | |
| 59 | + 'btn_text_color' => '#BEBEBE', | |
| 60 | + 'btn_bg' => '#4A4A4A', | |
| 61 | + 'btn_text_hover_color' => '#BEBEBE', | |
| 62 | + 'btn_hover_bg' => '#2D2D2D', | |
| 147 | 63 | ], |
| 148 | - 'set2' => [ | |
| 149 | - 'bg' => isset($options["dark_mode_color_set2"]) ? $options["dark_mode_color_set2"]['background'] : '#092635', | |
| 150 | - 'secondary_bg' => isset($options["dark_mode_color_set2"]) ? $options["dark_mode_color_set2"]['secondary_background'] : '#081E29', | |
| 151 | - 'text_color' => isset($options["dark_mode_link_color_set2"]) ? $options["dark_mode_link_color_set2"]['text'] : '#BEE0F1', | |
| 152 | - 'link_color' => isset($options["dark_mode_link_color_set2"]) ? $options["dark_mode_link_color_set2"]['color'] : '#2B97CD', | |
| 153 | - 'link_hover_color' => isset($options["dark_mode_link_color_set2"]) ? $options["dark_mode_link_color_set2"]['hover'] : '#BEE0F1', | |
| 154 | - 'input_bg' => isset($options["dark_mode_input_color_set2"]) ? $options["dark_mode_input_color_set2"]['background'] : '#2D2D2D', | |
| 155 | - 'input_text_color' => isset($options["dark_mode_input_color_set2"]) ? $options["dark_mode_input_color_set2"]['color'] : '#BEE0F1', | |
| 156 | - 'input_placeholder_color' => isset($options["dark_mode_input_color_set2"]) ? $options["dark_mode_input_color_set2"]['placeholder'] : '#BEE0F1', | |
| 157 | - 'border_color' => isset($options["dark_mode_border_color_set2"]) ? $options["dark_mode_border_color_set2"] : '#195979', | |
| 158 | - 'btn_text_color' => isset($options["dark_mode_btn_color_set2"]) ? $options["dark_mode_btn_color_set2"]['color'] : '#BEE0F1', | |
| 159 | - 'btn_bg' => isset($options["dark_mode_btn_color_set2"]) ? $options["dark_mode_btn_color_set2"]['background'] : '#195979', | |
| 160 | - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set2"]) ? $options["dark_mode_btn_color_set2"]['hover_color'] : '#BEE0F1', | |
| 161 | - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set2"]) ? $options["dark_mode_btn_color_set2"]['hover_background'] : '#2D2D2D', | |
| 162 | - 'btn_border_color' => isset($options["dark_mode_btn_color_set2"]['border']) ? $options["dark_mode_btn_color_set2"]['border'] : '#195979', | |
| 163 | - 'btn_hover_border_color' => isset($options["dark_mode_btn_color_set2"]['hover_border']) ? $options["dark_mode_btn_color_set2"]['hover_border'] : '#2D2D2D', | |
| 164 | - ], | |
| 165 | 64 | 'set3' => [ |
| 166 | 65 | 'bg' => isset($options["dark_mode_color_set3"]) ? $options["dark_mode_color_set3"]['background'] : '#211e3c', |
| 167 | 66 | 'secondary_bg' => isset($options["dark_mode_color_set3"]) ? $options["dark_mode_color_set3"]['secondary_background'] : '#302C57', |
| 168 | - 'text_color' => isset($options["dark_mode_link_color_set3"]) ? $options["dark_mode_link_color_set3"]['text'] : '#B1BBD8', | |
| 169 | - 'link_color' => isset($options["dark_mode_link_color_set3"]) ? $options["dark_mode_link_color_set3"]['color'] : '#8071fb', | |
| 170 | - 'link_hover_color' => isset($options["dark_mode_link_color_set3"]) ? $options["dark_mode_link_color_set3"]['hover'] : '#B1BBD8', | |
| 171 | - 'input_bg' => isset($options["dark_mode_input_color_set3"]) ? $options["dark_mode_input_color_set3"]['background'] : '#2A264D', | |
| 172 | - 'input_text_color' => isset($options["dark_mode_input_color_set3"]) ? $options["dark_mode_input_color_set3"]['color'] : '#B1BBD8', | |
| 173 | - 'input_placeholder_color' => isset($options["dark_mode_input_color_set3"]) ? $options["dark_mode_input_color_set3"]['placeholder'] : '#B1BBD8', | |
| 174 | - 'border_color' => isset($options["dark_mode_border_color_set3"]) ? $options["dark_mode_border_color_set3"] : '#4E478D', | |
| 175 | - 'btn_text_color' => isset($options["dark_mode_btn_color_set3"]) ? $options["dark_mode_btn_color_set3"]['color'] : '#B1BBD8', | |
| 176 | - 'btn_bg' => isset($options["dark_mode_btn_color_set3"]) ? $options["dark_mode_btn_color_set3"]['background'] : '#4E478D', | |
| 177 | - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set3"]) ? $options["dark_mode_btn_color_set3"]['hover_color'] : '#B1BBD8', | |
| 178 | - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set3"]) ? $options["dark_mode_btn_color_set3"]['hover_background'] : '#2A264D', | |
| 179 | - 'btn_border_color' => isset($options["dark_mode_btn_color_set3"]['border']) ? $options["dark_mode_btn_color_set3"]['border'] : '#4E478D', | |
| 180 | - 'btn_hover_border_color' => isset($options["dark_mode_btn_color_set3"]['hover_border']) ? $options["dark_mode_btn_color_set3"]['hover_border'] : '#2A264D', | |
| 67 | + 'text_color' => '#B1BBD8', | |
| 68 | + 'link_color' => '#8071fb', | |
| 69 | + 'link_hover_color' => '#B1BBD8', | |
| 70 | + 'input_bg' => '#2A264D', | |
| 71 | + 'input_text_color' => '#B1BBD8', | |
| 72 | + 'input_placeholder_color' => '#B1BBD8', | |
| 73 | + 'border_color' => '#4E478D', | |
| 74 | + 'btn_text_color' => '#B1BBD8', | |
| 75 | + 'btn_bg' => '#4E478D', | |
| 76 | + 'btn_text_hover_color' => '#B1BBD8', | |
| 77 | + 'btn_hover_bg' => '#2A264D', | |
| 181 | 78 | ], |
| 182 | - 'set4' => [ | |
| 183 | - 'bg' => isset($options["dark_mode_color_set4"]) ? $options["dark_mode_color_set4"]['background'] : '#1d253a', | |
| 184 | - 'secondary_bg' => isset($options["dark_mode_color_set4"]) ? $options["dark_mode_color_set4"]['secondary_background'] : '#2B3655', | |
| 185 | - 'text_color' => isset($options["dark_mode_link_color_set4"]) ? $options["dark_mode_link_color_set4"]['text'] : '#B1BBD8', | |
| 186 | - 'link_color' => isset($options["dark_mode_link_color_set4"]) ? $options["dark_mode_link_color_set4"]['color'] : '#638eff', | |
| 187 | - 'link_hover_color' => isset($options["dark_mode_link_color_set4"]) ? $options["dark_mode_link_color_set4"]['hover'] : '#B1BBD8', | |
| 188 | - 'input_bg' => isset($options["dark_mode_input_color_set4"]) ? $options["dark_mode_input_color_set4"]['background'] : '#242F4C', | |
| 189 | - 'input_text_color' => isset($options["dark_mode_input_color_set4"]) ? $options["dark_mode_input_color_set4"]['color'] : '#B1BBD8', | |
| 190 | - 'input_placeholder_color' => isset($options["dark_mode_input_color_set4"]) ? $options["dark_mode_input_color_set4"]['placeholder'] : '#B1BBD8', | |
| 191 | - 'border_color' => isset($options["dark_mode_border_color_set4"]) ? $options["dark_mode_border_color_set4"] : '#46598C', | |
| 192 | - 'btn_text_color' => isset($options["dark_mode_btn_color_set4"]) ? $options["dark_mode_btn_color_set4"]['color'] : '#B1BBD8', | |
| 193 | - 'btn_bg' => isset($options["dark_mode_btn_color_set4"]) ? $options["dark_mode_btn_color_set4"]['background'] : '#46598C', | |
| 194 | - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set4"]) ? $options["dark_mode_btn_color_set4"]['hover_color'] : '#B1BBD8', | |
| 195 | - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set4"]) ? $options["dark_mode_btn_color_set4"]['hover_background'] : '#303D60', | |
| 196 | - 'btn_border_color' => isset($options["dark_mode_btn_color_set4"]['border']) ? $options["dark_mode_btn_color_set4"]['border'] : '#46598C', | |
| 197 | - 'btn_hover_border_color' => isset($options["dark_mode_btn_color_set4"]['hover_border']) ? $options["dark_mode_btn_color_set4"]['hover_border'] : '#303D60', | |
| 79 | + 'set9' => [ | |
| 80 | + 'bg' => isset($options["dark_mode_color_set9"]) ? $options["dark_mode_color_set9"]['background'] : '#04261d', | |
| 81 | + 'secondary_bg' => isset($options["dark_mode_color_set9"]) ? $options["dark_mode_color_set9"]['secondary_background'] : '#021e16', | |
| 82 | + 'text_color' => '#C1D2BB', | |
| 83 | + 'link_color' => '#00d29a', | |
| 84 | + 'link_hover_color' => '#C1D2BB', | |
| 85 | + 'input_bg' => '#073d2f', | |
| 86 | + 'input_text_color' => '#C1D2BB', | |
| 87 | + 'input_placeholder_color' => '#C1D2BB', | |
| 88 | + 'border_color' => '#095541', | |
| 89 | + 'btn_text_color' => '#C1D2BB', | |
| 90 | + 'btn_bg' => '#095541', | |
| 91 | + 'btn_text_hover_color' => '#C1D2BB', | |
| 92 | + 'btn_hover_bg' => '#073d2f', | |
| 198 | 93 | ], |
| 199 | - 'set5' => [ | |
| 200 | - 'bg' => isset($options["dark_mode_color_set5"]) ? $options["dark_mode_color_set5"]['background'] : '#1b1823', | |
| 201 | - 'secondary_bg' => isset($options["dark_mode_color_set5"]) ? $options["dark_mode_color_set5"]['secondary_background'] : '#352f44', | |
| 202 | - 'text_color' => isset($options["dark_mode_link_color_set5"]) ? $options["dark_mode_link_color_set5"]['text'] : '#C6C1D5', | |
| 203 | - 'link_color' => isset($options["dark_mode_link_color_set5"]) ? $options["dark_mode_link_color_set5"]['color'] : '#b094ff', | |
| 204 | - 'link_hover_color' => isset($options["dark_mode_link_color_set5"]) ? $options["dark_mode_link_color_set5"]['hover'] : '#C6C1D5', | |
| 205 | - 'input_bg' => isset($options["dark_mode_input_color_set5"]) ? $options["dark_mode_input_color_set5"]['background'] : '#403953', | |
| 206 | - 'input_text_color' => isset($options["dark_mode_input_color_set5"]) ? $options["dark_mode_input_color_set5"]['color'] : '#C6C1D5', | |
| 207 | - 'input_placeholder_color' => isset($options["dark_mode_input_color_set5"]) ? $options["dark_mode_input_color_set5"]['placeholder'] : '#C6C1D5', | |
| 208 | - 'border_color' => isset($options["dark_mode_border_color_set5"]) ? $options["dark_mode_border_color_set5"] : '#54496f', | |
| 209 | - 'btn_text_color' => isset($options["dark_mode_btn_color_set5"]) ? $options["dark_mode_btn_color_set5"]['color'] : '#C6C1D5', | |
| 210 | - 'btn_bg' => isset($options["dark_mode_btn_color_set5"]) ? $options["dark_mode_btn_color_set5"]['background'] : '#54496f', | |
| 211 | - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set5"]) ? $options["dark_mode_btn_color_set5"]['hover_color'] : '#C6C1D5', | |
| 212 | - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set5"]) ? $options["dark_mode_btn_color_set5"]['hover_background'] : '#403953', | |
| 213 | - 'btn_border_color' => isset($options["dark_mode_btn_color_set5"]['border']) ? $options["dark_mode_btn_color_set5"]['border'] : '#54496f', | |
| 214 | - 'btn_hover_border_color' => isset($options["dark_mode_btn_color_set5"]['hover_border']) ? $options["dark_mode_btn_color_set5"]['hover_border'] : '#403953', | |
| 215 | - ], | |
| 216 | 94 | 'set6' => [ |
| 217 | 95 | 'bg' => isset($options["dark_mode_color_set6"]) ? $options["dark_mode_color_set6"]['background'] : '#082032', |
| 218 | 96 | 'secondary_bg' => isset($options["dark_mode_color_set6"]) ? $options["dark_mode_color_set6"]['secondary_background'] : '#061825', |
| 219 | - 'text_color' => isset($options["dark_mode_link_color_set6"]) ? $options["dark_mode_link_color_set6"]['text'] : '#B5D9F3', | |
| 220 | - 'link_color' => isset($options["dark_mode_link_color_set6"]) ? $options["dark_mode_link_color_set6"]['color'] : '#61bbff', | |
| 221 | - 'link_hover_color' => isset($options["dark_mode_link_color_set6"]) ? $options["dark_mode_link_color_set6"]['hover'] : '#B5D9F3', | |
| 222 | - 'input_bg' => isset($options["dark_mode_input_color_set6"]) ? $options["dark_mode_input_color_set6"]['background'] : '#0E3755', | |
| 223 | - 'input_text_color' => isset($options["dark_mode_input_color_set6"]) ? $options["dark_mode_input_color_set6"]['color'] : '#B5D9F3', | |
| 224 | - 'input_placeholder_color' => isset($options["dark_mode_input_color_set6"]) ? $options["dark_mode_input_color_set6"]['placeholder'] : '#B5D9F3', | |
| 225 | - 'border_color' => isset($options["dark_mode_border_color_set6"]) ? $options["dark_mode_border_color_set6"] : '#144E78', | |
| 226 | - 'btn_text_color' => isset($options["dark_mode_btn_color_set6"]) ? $options["dark_mode_btn_color_set6"]['color'] : '#B5D9F3', | |
| 227 | - 'btn_bg' => isset($options["dark_mode_btn_color_set6"]) ? $options["dark_mode_btn_color_set6"]['background'] : '#144E78', | |
| 228 | - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set6"]) ? $options["dark_mode_btn_color_set6"]['hover_color'] : '#B5D9F3', | |
| 229 | - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set6"]) ? $options["dark_mode_btn_color_set6"]['hover_background'] : '#0E3755', | |
| 230 | - 'btn_border_color' => isset($options["dark_mode_btn_color_set6"]['border']) ? $options["dark_mode_btn_color_set6"]['border'] : '#144E78', | |
| 231 | - 'btn_hover_border_color' => isset($options["dark_mode_btn_color_set6"]['hover_border']) ? $options["dark_mode_btn_color_set6"]['hover_border'] : '#0E3755', | |
| 97 | + 'text_color' => '#B5D9F3', | |
| 98 | + 'link_color' => '#61bbff', | |
| 99 | + 'link_hover_color' => '#B5D9F3', | |
| 100 | + 'input_bg' => '#0E3755', | |
| 101 | + 'input_text_color' => '#B5D9F3', | |
| 102 | + 'input_placeholder_color' => '#B5D9F3', | |
| 103 | + 'border_color' => '#144E78', | |
| 104 | + 'btn_text_color' => '#B5D9F3', | |
| 105 | + 'btn_bg' => '#144E78', | |
| 106 | + 'btn_text_hover_color' => '#B5D9F3', | |
| 107 | + 'btn_hover_bg' => '#0E3755', | |
| 232 | 108 | ], |
| 233 | - 'set7' => [ | |
| 234 | - 'bg' => isset($options["dark_mode_color_set7"]) ? $options["dark_mode_color_set7"]['background'] : '#07161b', | |
| 235 | - 'secondary_bg' => isset($options["dark_mode_color_set7"]) ? $options["dark_mode_color_set7"]['secondary_background'] : '#0d242e', | |
| 236 | - 'text_color' => isset($options["dark_mode_link_color_set7"]) ? $options["dark_mode_link_color_set7"]['text'] : '#C5E6F0', | |
| 237 | - 'link_color' => isset($options["dark_mode_link_color_set7"]) ? $options["dark_mode_link_color_set7"]['color'] : '#33c0ec', | |
| 238 | - 'link_hover_color' => isset($options["dark_mode_link_color_set7"]) ? $options["dark_mode_link_color_set7"]['hover'] : '#C5E6F0', | |
| 239 | - 'input_bg' => isset($options["dark_mode_input_color_set7"]) ? $options["dark_mode_input_color_set7"]['background'] : '#19495A', | |
| 240 | - 'input_text_color' => isset($options["dark_mode_input_color_set7"]) ? $options["dark_mode_input_color_set7"]['color'] : '#C5E6F0', | |
| 241 | - 'input_placeholder_color' => isset($options["dark_mode_input_color_set7"]) ? $options["dark_mode_input_color_set7"]['placeholder'] : '#C5E6F0', | |
| 242 | - 'border_color' => isset($options["dark_mode_border_color_set7"]) ? $options["dark_mode_border_color_set7"] : '#286F8D', | |
| 243 | - 'btn_text_color' => isset($options["dark_mode_btn_color_set7"]) ? $options["dark_mode_btn_color_set7"]['color'] : '#C5E6F0', | |
| 244 | - 'btn_bg' => isset($options["dark_mode_btn_color_set7"]) ? $options["dark_mode_btn_color_set7"]['background'] : '#286F8D', | |
| 245 | - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set7"]) ? $options["dark_mode_btn_color_set7"]['hover_color'] : '#C5E6F0', | |
| 246 | - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set7"]) ? $options["dark_mode_btn_color_set7"]['hover_background'] : '#19495A', | |
| 247 | - 'btn_border_color' => isset($options["dark_mode_btn_color_set7"]['border']) ? $options["dark_mode_btn_color_set7"]['border'] : '#286F8D', | |
| 248 | - 'btn_hover_border_color' => isset($options["dark_mode_btn_color_set7"]['hover_border']) ? $options["dark_mode_btn_color_set7"]['hover_border'] : '#19495A', | |
| 249 | - ], | |
| 250 | - 'set8' => [ | |
| 251 | - 'bg' => isset($options["dark_mode_color_set8"]) ? $options["dark_mode_color_set8"]['background'] : '#15274C', | |
| 252 | - 'secondary_bg' => isset($options["dark_mode_color_set8"]) ? $options["dark_mode_color_set8"]['secondary_background'] : '#112244', | |
| 253 | - 'text_color' => isset($options["dark_mode_link_color_set8"]) ? $options["dark_mode_link_color_set8"]['text'] : '#ACC1EA', | |
| 254 | - 'link_color' => isset($options["dark_mode_link_color_set8"]) ? $options["dark_mode_link_color_set8"]['color'] : '#6197ff', | |
| 255 | - 'link_hover_color' => isset($options["dark_mode_link_color_set8"]) ? $options["dark_mode_link_color_set8"]['hover'] : '#ACC1EA', | |
| 256 | - 'input_bg' => isset($options["dark_mode_input_color_set8"]) ? $options["dark_mode_input_color_set8"]['background'] : '#1a2f5c', | |
| 257 | - 'input_text_color' => isset($options["dark_mode_input_color_set8"]) ? $options["dark_mode_input_color_set8"]['color'] : '#ACC1EA', | |
| 258 | - 'input_placeholder_color' => isset($options["dark_mode_input_color_set8"]) ? $options["dark_mode_input_color_set8"]['placeholder'] : '#ACC1EA', | |
| 259 | - 'border_color' => isset($options["dark_mode_border_color_set8"]) ? $options["dark_mode_border_color_set8"] : '#244892', | |
| 260 | - 'btn_text_color' => isset($options["dark_mode_btn_color_set8"]) ? $options["dark_mode_btn_color_set8"]['color'] : '#ACC1EA', | |
| 261 | - 'btn_bg' => isset($options["dark_mode_btn_color_set8"]) ? $options["dark_mode_btn_color_set8"]['background'] : '#244892', | |
| 262 | - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set8"]) ? $options["dark_mode_btn_color_set8"]['hover_color'] : '#ACC1EA', | |
| 263 | - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set8"]) ? $options["dark_mode_btn_color_set8"]['hover_background'] : '#1a2f5c', | |
| 264 | - 'btn_border_color' => isset($options["dark_mode_btn_color_set8"]['border']) ? $options["dark_mode_btn_color_set8"]['border'] : '#244892', | |
| 265 | - 'btn_hover_border_color' => isset($options["dark_mode_btn_color_set8"]['hover_border']) ? $options["dark_mode_btn_color_set8"]['hover_border'] : '#1a2f5c', | |
| 266 | - ], | |
| 267 | - 'set9' => [ | |
| 268 | - 'bg' => isset($options["dark_mode_color_set9"]) ? $options["dark_mode_color_set9"]['background'] : '#04261d', | |
| 269 | - 'secondary_bg' => isset($options["dark_mode_color_set9"]) ? $options["dark_mode_color_set9"]['secondary_background'] : '#021e16', | |
| 270 | - 'text_color' => isset($options["dark_mode_link_color_set9"]) ? $options["dark_mode_link_color_set9"]['text'] : '#C1D2BB', | |
| 271 | - 'link_color' => isset($options["dark_mode_link_color_set9"]) ? $options["dark_mode_link_color_set9"]['color'] : '#00d29a', | |
| 272 | - 'link_hover_color' => isset($options["dark_mode_link_color_set9"]) ? $options["dark_mode_link_color_set9"]['hover'] : '#C1D2BB', | |
| 273 | - 'input_bg' => isset($options["dark_mode_input_color_set9"]) ? $options["dark_mode_input_color_set9"]['background'] : '#073d2f', | |
| 274 | - 'input_text_color' => isset($options["dark_mode_input_color_set9"]) ? $options["dark_mode_input_color_set9"]['color'] : '#C1D2BB', | |
| 275 | - 'input_placeholder_color' => isset($options["dark_mode_input_color_set9"]) ? $options["dark_mode_input_color_set9"]['placeholder'] : '#C1D2BB', | |
| 276 | - 'border_color' => isset($options["dark_mode_border_color_set9"]) ? $options["dark_mode_border_color_set9"] : '#095541', | |
| 277 | - 'btn_text_color' => isset($options["dark_mode_btn_color_set9"]) ? $options["dark_mode_btn_color_set9"]['color'] : '#C1D2BB', | |
| 278 | - 'btn_bg' => isset($options["dark_mode_btn_color_set9"]) ? $options["dark_mode_btn_color_set9"]['background'] : '#095541', | |
| 279 | - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set9"]) ? $options["dark_mode_btn_color_set9"]['hover_color'] : '#C1D2BB', | |
| 280 | - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set9"]) ? $options["dark_mode_btn_color_set9"]['hover_background'] : '#073d2f', | |
| 281 | - 'btn_border_color' => isset($options["dark_mode_btn_color_set9"]['border']) ? $options["dark_mode_btn_color_set9"]['border'] : '#095541', | |
| 282 | - 'btn_hover_border_color' => isset($options["dark_mode_btn_color_set9"]['hover_border']) ? $options["dark_mode_btn_color_set9"]['hover_border'] : '#073d2f', | |
| 283 | - ], | |
| 284 | 109 | 'set10' => [ |
| 285 | 110 | 'bg' => isset($options["dark_mode_color_set10"]) ? $options["dark_mode_color_set10"]['background'] : '#171004', |
| 286 | 111 | 'secondary_bg' => isset($options["dark_mode_color_set10"]) ? $options["dark_mode_color_set10"]['secondary_background'] : '#211706', |
| 287 | - 'text_color' => isset($options["dark_mode_link_color_set10"]) ? $options["dark_mode_link_color_set10"]['text'] : '#E0D2BD', | |
| 288 | - 'link_color' => isset($options["dark_mode_link_color_set10"]) ? $options["dark_mode_link_color_set10"]['color'] : '#e09525', | |
| 289 | - 'link_hover_color' => isset($options["dark_mode_link_color_set10"]) ? $options["dark_mode_link_color_set10"]['hover'] : '#E0D2BD', | |
| 290 | - 'input_bg' => isset($options["dark_mode_input_color_set10"]) ? $options["dark_mode_input_color_set10"]['background'] : '#372911', | |
| 291 | - 'input_text_color' => isset($options["dark_mode_input_color_set10"]) ? $options["dark_mode_input_color_set10"]['color'] : '#E0D2BD', | |
| 292 | - 'input_placeholder_color' => isset($options["dark_mode_input_color_set10"]) ? $options["dark_mode_input_color_set10"]['placeholder'] : '#E0D2BD', | |
| 293 | - 'border_color' => isset($options["dark_mode_border_color_set10"]) ? $options["dark_mode_border_color_set10"] : '#5D4010', | |
| 294 | - 'btn_text_color' => isset($options["dark_mode_btn_color_set10"]) ? $options["dark_mode_btn_color_set10"]['color'] : '#E0D2BD', | |
| 295 | - 'btn_bg' => isset($options["dark_mode_btn_color_set10"]) ? $options["dark_mode_btn_color_set10"]['background'] : '#5D4010', | |
| 296 | - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set10"]) ? $options["dark_mode_btn_color_set10"]['hover_color'] : '#E0D2BD', | |
| 297 | - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set10"]) ? $options["dark_mode_btn_color_set10"]['hover_background'] : '#372911', | |
| 298 | - 'btn_border_color' => isset($options["dark_mode_btn_color_set10"]['border']) ? $options["dark_mode_btn_color_set10"]['border'] : '#5D4010', | |
| 299 | - 'btn_hover_border_color' => isset($options["dark_mode_btn_color_set10"]['hover_border']) ? $options["dark_mode_btn_color_set10"]['hover_border'] : '#372911', | |
| 112 | + 'text_color' => '#E0D2BD', | |
| 113 | + 'link_color' => '#e09525', | |
| 114 | + 'link_hover_color' => '#E0D2BD', | |
| 115 | + 'input_bg' => '#372911', | |
| 116 | + 'input_text_color' => '#E0D2BD', | |
| 117 | + 'input_placeholder_color' => '#E0D2BD', | |
| 118 | + 'border_color' => '#5D4010', | |
| 119 | + 'btn_text_color' => '#E0D2BD', | |
| 120 | + 'btn_bg' => '#5D4010', | |
| 121 | + 'btn_text_hover_color' => '#E0D2BD', | |
| 122 | + 'btn_hover_bg' => '#372911', | |
| 300 | 123 | ], |
| 301 | - 'set11' => [ | |
| 302 | - 'bg' => isset($options["dark_mode_color_set11"]) ? $options["dark_mode_color_set11"]['background'] : '#19081b', | |
| 303 | - 'secondary_bg' => isset($options["dark_mode_color_set11"]) ? $options["dark_mode_color_set11"]['secondary_background'] : '#210a24', | |
| 304 | - 'text_color' => isset($options["dark_mode_link_color_set11"]) ? $options["dark_mode_link_color_set11"]['text'] : '#c09dc2', | |
| 305 | - 'link_color' => isset($options["dark_mode_link_color_set11"]) ? $options["dark_mode_link_color_set11"]['color'] : '#c832d4', | |
| 306 | - 'link_hover_color' => isset($options["dark_mode_link_color_set11"]) ? $options["dark_mode_link_color_set11"]['hover'] : '#c09dc2', | |
| 307 | - 'input_bg' => isset($options["dark_mode_input_color_set11"]) ? $options["dark_mode_input_color_set11"]['background'] : '#2c082f', | |
| 308 | - 'input_text_color' => isset($options["dark_mode_input_color_set11"]) ? $options["dark_mode_input_color_set11"]['color'] : '#c09dc2', | |
| 309 | - 'input_placeholder_color' => isset($options["dark_mode_input_color_set11"]) ? $options["dark_mode_input_color_set11"]['placeholder'] : '#c09dc2', | |
| 310 | - 'border_color' => isset($options["dark_mode_border_color_set11"]) ? $options["dark_mode_border_color_set11"] : '#440649', | |
| 311 | - 'btn_text_color' => isset($options["dark_mode_btn_color_set11"]) ? $options["dark_mode_btn_color_set11"]['color'] : '#c09dc2', | |
| 312 | - 'btn_bg' => isset($options["dark_mode_btn_color_set11"]) ? $options["dark_mode_btn_color_set11"]['background'] : '#440649', | |
| 313 | - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set11"]) ? $options["dark_mode_btn_color_set11"]['hover_color'] : '#c09dc2', | |
| 314 | - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set11"]) ? $options["dark_mode_btn_color_set11"]['hover_background'] : '#2c082f', | |
| 315 | - 'btn_border_color' => isset($options["dark_mode_btn_color_set11"]['border']) ? $options["dark_mode_btn_color_set11"]['border'] : '#440649', | |
| 316 | - 'btn_hover_border_color' => isset($options["dark_mode_btn_color_set11"]['hover_border']) ? $options["dark_mode_btn_color_set11"]['hover_border'] : '#2c082f', | |
| 317 | - ], | |
| 318 | 124 | ]; |
| 319 | 125 | |
| 126 | + | |
| 320 | 127 | $selected_set_key = isset($options['color_pallets']) ? $options['color_pallets'] : 'set1'; |
| 321 | 128 | $selected_set = $dark_mode_color_palettes[$selected_set_key] ?? $dark_mode_color_palettes['set1']; |
| 322 | 129 | |
| 323 | 130 | // Output as CSS variables |
| @@ -326,55 +133,9 @@ | ||
| 326 | 133 | } |
| 327 | 134 | ?> |
| 328 | 135 | } |
| 329 | 136 | </style> |
| 330 | -<?php } else { | |
| 331 | - /* | |
| 332 | - * `dark` on <html> is the de-facto convention a React admin themes itself | |
| 333 | - * off — Tailwind's class strategy, shadcn/ui, and Darkify's own React admin | |
| 334 | - * (`@custom-variant dark (&:is(.dark *))`) all key on exactly this class. | |
| 335 | - * | |
| 336 | - * It used to be added only on Darkify's own SPA pages, which is why a | |
| 337 | - * React-based admin screen from ANOTHER plugin stayed stubbornly light while | |
| 338 | - * the rest of wp-admin went dark: such an app doesn't take its colours from | |
| 339 | - * the cascade at all, it reads design tokens that only switch when `dark` is | |
| 340 | - * present, and that class never arrived. Mirroring Admin Panel Dark Mode | |
| 341 | - * onto it here — on every admin screen, not just ours — lets any app | |
| 342 | - * following the convention inherit the theme with no plugin-specific | |
| 343 | - * handling on either side. | |
| 344 | - * | |
| 345 | - * Setting it in <head> means the very first paint is already dark; the | |
| 346 | - * runtime half of the mirror lives in client_main.js so the admin-bar switch | |
| 347 | - * re-themes those screens live too. The `h.classList.add('dark')` call is | |
| 348 | - * emitted as a static literal in the snippet below. | |
| 349 | - */ | |
| 350 | - /* | |
| 351 | - * `d` gates this FOUC snippet on Admin Panel Dark Mode actually being ON. | |
| 352 | - * It used to be implicit: with the option off this template was never | |
| 353 | - * included on an admin screen. Darkify's own SPA screens now always | |
| 354 | - * include it (so the admin-bar icon can toggle without a reload), so | |
| 355 | - * without this check a stale `darkify_admin_panel_last_state = "1"` would | |
| 356 | - * darken the screen even though the option is off. | |
| 357 | - * | |
| 358 | - * Nested ifs, NOT `s==='1'&&d==='1'`: this whole template is printed | |
| 359 | - * through wp_kses() (see the bottom of the file), whose entity | |
| 360 | - * normalization rewrites a bare `&` to `&` — script content is raw | |
| 361 | - * text, so `&&` would reach the browser as `&&` and kill the | |
| 362 | - * snippet with a SyntaxError. Keep this snippet free of `&` (and `<`). | |
| 363 | - */ | |
| 364 | - /* | |
| 365 | - * Effective admin darkening for THIS screen. Block Editor Dark Mode is | |
| 366 | - * independent of Admin Panel Dark Mode: the block editor darkens when Block | |
| 367 | - * Editor Dark Mode is on even if Admin Panel Dark Mode is off. Reused for the | |
| 368 | - * runtime gate (darkify_admin_panel_dark_enabled) below. | |
| 369 | - */ | |
| 370 | - $darkify_screen = \function_exists('get_current_screen') ? \get_current_screen() : null; | |
| 371 | - $darkify_is_block_editor = $darkify_screen && \method_exists($darkify_screen, 'is_block_editor') && $darkify_screen->is_block_editor(); | |
| 372 | - $darkify_block_editor_dark = !empty($options['block_editor_dark_mode']); | |
| 373 | - $darkify_effective_admin_dark = (!empty($options['enable_admin_panel_dark_mode']) || ($darkify_is_block_editor && $darkify_block_editor_dark)) ? '1' : '0'; | |
| 374 | - $darkify_admin_dark_on = $darkify_effective_admin_dark; | |
| 375 | - ?> | |
| 376 | - <script type="text/javascript" class="darkify_inline_js">(function(){var s=localStorage.darkify_admin_panel_last_state,t=localStorage.darkify_selected_theme||'set1',d='<?php echo esc_attr($darkify_admin_dark_on); ?>';if(s==='1'){if(d==='1'){var h=document.documentElement;h.classList.add('darkify_dark_mode_enabled');h.classList.add('darkify-'+t);h.classList.add('dark');}}}());</script> | |
| 137 | +<?php } else { ?> | |
| 377 | 138 | <style type="text/css" class="darkify_inline_css"> |
| 378 | 139 | :root { |
| 379 | 140 | --darkify_dark_mode_bg: #181a1b; |
| 380 | 141 | --darkify_dark_mode_secondary_bg: #202324; |
| @@ -386,18 +147,15 @@ | ||
| 386 | 147 | --darkify_dark_mode_input_placeholder_color: #989898; |
| 387 | 148 | --darkify_dark_mode_border_color: #4A4A4A; |
| 388 | 149 | --darkify_dark_mode_btn_bg: #2D2D2D; |
| 389 | 150 | --darkify_dark_mode_btn_text_color: #BEBEBE; |
| 390 | - --darkify_dark_mode_btn_hover_bg: #BEBEBE; | |
| 391 | - --darkify_dark_mode_btn_text_hover_color: #2D2D2D; | |
| 392 | - --darkify_dark_mode_btn_border_color: #2D2D2D; | |
| 393 | - --darkify_dark_mode_btn_hover_border_color: #BEBEBE; | |
| 394 | 151 | } |
| 395 | 152 | </style> |
| 396 | 153 | <?php } |
| 154 | + | |
| 397 | 155 | if ($enable_scrollbar_dark) { |
| 398 | - $dark_mode_scrollbar_track_bg = !empty($options["scrollbar_color"]) ? $options["scrollbar_color"]['dark_mode_scrollbar_track_bg'] : ''; | |
| 399 | - $dark_mode_scrollbar_thumb_bg = !empty($options["scrollbar_color"]) ? $options["scrollbar_color"]['dark_mode_scrollbar_thumb_bg'] : ''; | |
| 156 | + $dark_mode_scrollbar_track_bg = '#29292a'; | |
| 157 | + $dark_mode_scrollbar_thumb_bg = '#52565a'; | |
| 400 | 158 | include DarkifyUtils::darkify_locate_template('views/scrollbar.php'); |
| 401 | 159 | } |
| 402 | 160 | ?> |
| 403 | 161 | |
| @@ -406,46 +164,27 @@ | ||
| 406 | 164 | var darkify_is_this_admin_panel = "<?php echo esc_attr(is_admin() ? "1" : "0"); ?>"; |
| 407 | 165 | var darkify_enable_default_dark_mode = "<?php echo esc_attr($enable_default_dark_mode); ?>"; |
| 408 | 166 | var darkify_enable_os_aware = "<?php echo esc_attr($enable_os_aware); ?>"; |
| 409 | 167 | var darkify_enable_keyboard_shortcut = "<?php echo esc_attr($enable_keyboard_shortcut); ?>"; |
| 410 | - var darkify_keyboard_shortcut_keys = "<?php echo esc_attr($keyboard_shortcut_keys); ?>"; | |
| 411 | 168 | var darkify_enable_time_based_dark = "<?php echo esc_attr($enable_time_based_dark); ?>"; |
| 412 | - var darkify_time_based_dark_start = "<?php echo esc_attr($time_based_dark_start ? $time_based_dark_start : "19:00"); ?>"; | |
| 413 | - var darkify_time_based_dark_stop = "<?php echo esc_attr($time_based_dark_stop ? $time_based_dark_stop : "07:00"); ?>"; | |
| 414 | - var darkify_enable_switch_dragging = "<?php echo esc_attr($enable_switch_dragging); ?>"; | |
| 415 | - var darkify_enable_switch_attention = "<?php echo esc_attr($enable_switch_attention); ?>"; | |
| 416 | - var darkify_switch_attention_effect = "<?php echo esc_attr($switch_attention_effect); ?>"; | |
| 417 | - | |
| 169 | + var darkify_time_based_dark_start = "<?php echo esc_attr($time_based_dark_start ? $time_based_dark_start : ""); ?>"; | |
| 170 | + var darkify_time_based_dark_stop = "<?php echo esc_attr($time_based_dark_stop ? $time_based_dark_stop : ""); ?>"; | |
| 418 | 171 | var darkify_alternative_dark_mode_switch = "<?php echo esc_attr($alternative_dark_mode_switcher); ?>"; |
| 419 | - var darkify_enable_frontend_iframe_dark_mode = "<?php echo esc_attr($enable_frontend_iframe_dark_mode); ?>"; | |
| 420 | 172 | var darkify_enable_low_image_brightness = "<?php echo esc_attr($enable_low_image_brightness); ?>"; |
| 421 | 173 | var darkify_image_brightness_to = "<?php echo esc_attr($low_image_brightness_label); ?>"; |
| 422 | - var darkify_disallowed_low_brightness_images = "<?php echo esc_attr($disallowed_low_brightness_images); ?>"; | |
| 423 | 174 | var darkify_enable_image_grayscale = "<?php echo esc_attr($enable_image_grayscale); ?>"; |
| 424 | 175 | var darkify_image_grayscale_to = "<?php echo esc_attr($image_grayscale_label); ?>"; |
| 425 | - var darkify_disallowed_grayscale_images = "<?php echo esc_attr($disallowed_low_grayscale_images); ?>"; | |
| 426 | 176 | var darkify_enable_bg_image_darken = "<?php echo esc_attr($enable_low_image_darken); ?>"; |
| 427 | 177 | var darkify_bg_image_darken_to = "<?php echo esc_attr($low_image_darken_label); ?>"; |
| 428 | 178 | var darkify_enable_invert_inline_svg = "<?php echo esc_attr($enable_invert_inline_svg); ?>"; |
| 429 | - var darkify_enable_invert_images = "<?php echo esc_attr($enable_invert_images); ?>"; | |
| 430 | - var darkify_invert_images_allowed_urls = "<?php echo esc_attr($invert_images_allowed_urls_arr); ?>"; | |
| 431 | - var darkify_image_replacements = "<?php echo esc_attr($image_replacements) ?>"; | |
| 432 | 179 | var darkify_enable_low_video_brightness = "<?php echo esc_attr($enable_low_video_brightness); ?>"; |
| 433 | 180 | var darkify_video_brightness_to = "<?php echo esc_attr($low_video_brightness_label); ?>"; |
| 434 | 181 | var darkify_enable_video_grayscale = "<?php echo esc_attr($enable_video_grayscale); ?>"; |
| 435 | 182 | var darkify_video_grayscale_to = "<?php echo esc_attr($video_grayscale_label); ?>"; |
| 436 | - var darkify_video_replacements = "<?PHP echo esc_attr($video_replacements); ?>"; | |
| 437 | - var darkify_allowed_elements = "<?php echo esc_attr($this->utils->generateAllowedElementsStr($options)); ?>"; | |
| 438 | - var darkify_allowed_elements_raw = "<?php echo esc_attr($allowed_elements); ?>"; | |
| 439 | - var darkify_allowed_elements_force_to_correct = "<?php echo esc_attr($allowed_elements_force_to_correct); ?>"; | |
| 440 | 183 | |
| 441 | 184 | var darkify_disallowed_elements = "<?php echo esc_attr($this->utils->generateDisallowedElementsStr($options, $this->external_support)); ?>"; |
| 442 | - var darkify_disallowed_elements_raw = "<?php echo esc_attr($disallowed_elements); ?>"; | |
| 443 | - var darkify_disallowed_elements_force_to_correct = "<?php echo esc_attr($disallowed_elements_force_to_correct); ?>"; | |
| 444 | - | |
| 445 | 185 | var darkify_allowed_btn_class = <?php echo json_encode($this->utils->addButtonClassByDarkify($options)); ?>; |
| 446 | - | |
| 447 | - var darkify_color_overrides = <?php echo wp_json_encode($darkify_color_overrides); ?>; | |
| 186 | + | |
| 448 | 187 | </script> |
| 449 | 188 | <?php |
| 450 | 189 | $output = ob_get_clean(); |
| 451 | 190 | $tags_allowed_in_output = array( |