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