Changeset 2927586
- Timestamp:
- 06/18/2023 04:42:10 PM (3 years ago)
- Location:
- ele-ui-color-scheme-restoration/trunk
- Files:
-
- 4 edited
-
core/class-ele-ui-color-scheme-restoration.php (modified) (1 diff)
-
core/includes/assets/css/backend-styles.css (modified) (1 diff)
-
ele-ui-color-scheme-restoration.php (modified) (5 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ele-ui-color-scheme-restoration/trunk/core/class-ele-ui-color-scheme-restoration.php
r2924995 r2927586 155 155 { 156 156 load_plugin_textdomain('ele-ui-color-scheme-restoration', "", dirname(plugin_basename(ELEUICOLOR_PLUGIN_FILE)) . '/languages/'); 157 } 157 158 } 159 160 /** 161 * Destroy options when plugin is deleted or color need a reset back to defaults. 162 * 163 * @access public 164 * @since 1.0.0 165 * @return void 166 */ 167 public function ele_ui_color_scheme_destroy_options() 168 { 169 170 delete_option('ele-ui-color-scheme-restoration-settings'); 171 172 } 173 /** 174 * Create options when plugin is activated. 175 * 176 * @access public 177 * @since 1.0.0 178 * @return void 179 */ 180 181 public function ele_ui_color_scheme_create_options_with_defaults() 182 { 183 //setup default color srrays 184 185 $default_dark_colors = array( 186 '--e-a-bg-default' => '#1f2124', 187 '--e-a-dark-bg' => '#26292C', 188 '--e-a-dark-color-txt' => '#A4AFB7', 189 '--e-a-dark-color-txt-hover' => '#d5d8dc', 190 '--e-a-btn-bg-primary' => '#39B54A', 191 '--e-a-btn-bg-primary-hover' => '#36A046', 192 '--e-a-btn-bg-primary-active' => '#39B54A', 193 '--e-a-bg-hover' => '#71D7F7', 194 '--e-a-bg-active' => '#71D7F7', 195 '--e-a-border-color' => '#000000', 196 '--e-a-border-color-focus' => '#000000', 197 '--e-a-bg-primary' => '#71d7f7', 198 '--e-a-color-txt' => '#ffffff', 199 '--e-a-color-primary-bold' => '#ffffff', 200 '--e-a-color-info' => '#2563eb', 201 '--e-a-border-color-bold' => '#ffffff', 202 '--e-a-bg-active-bold' => '##71D7F7', 203 ); 204 205 $default_light_colors = array( 206 '--e-a-bg-default' => '#E6E9EC', 207 '--e-a-dark-bg' => '#93003C', 208 '--e-a-dark-color-txt' => '#A4AFB7', 209 '--e-a-dark-color-txt-hover' => '#FFFFFF', 210 '--e-a-btn-bg-primary' => '#39B54A', 211 '--e-a-btn-bg-primary-hover' => '#36A046', 212 '--e-a-btn-bg-primary-active' => '#39B54A', 213 '--e-a-bg-hover' => '#71D7F7', 214 '--e-a-bg-active' => '#71D7F7', 215 '--e-a-border-color' => '#000000', 216 '--e-a-border-color-focus' => '#000000', 217 '--e-a-bg-primary' => '#71d7f7', 218 '--e-a-color-txt' => '#000000', 219 '--e-a-color-primary-bold' => '#ffffff', 220 '--e-a-color-info' => '#2563EB', 221 '--e-a-border-color-bold' => '#000000', 222 '--e-a-bg-active-bold' => '##71D7F7', 223 224 ); 225 226 $default_brand_colors = array( 227 '--brand-color' => '#71D7F7', 228 '--brand-color-hover' => '#65C1DE', 229 '--brand-color-active' => '#65C1DE', 230 231 ); 232 233 // Retrieve the posted color values 234 $default_color_options = array( 235 'dark_mode_colors' => $default_dark_colors, 236 'light_mode_colors' => $default_light_colors, 237 'brand_colors' => $default_brand_colors 238 ); 239 240 // Update the options with the new color values 241 add_option('ele-ui-color-scheme-restoration-settings', $default_color_options); 242 ////ELEUICOLOR()->ele_ui_color_scheme_logger("Running Reset"); 243 $current_light_colors = get_option('light_mode_colors'); 244 $current_dark_colors = get_option('dark_mode_colors'); 245 $current_ele_ui_color_scheme_restoration_settings = get_option('ele-ui-color-scheme-restoration-settings'); 246 ////ELEUICOLOR()->ele_ui_color_scheme_logger($current_dark_colors); 247 ////ELEUICOLOR()->ele_ui_color_scheme_logger($current_light_colors); 248 ////ELEUICOLOR()->ele_ui_color_scheme_logger($current_ele_ui_color_scheme_restoration_settings); 249 } 250 251 function ele_ui_color_scheme_save_colors() 252 { 253 // Retrieve the posted color values 254 $dark_mode_colors = $_POST['dark_mode']; 255 $light_mode_colors = $_POST['light_mode']; 256 $brand_colors = $_POST['brand_colors']; 257 //echo '<script>console.log(' . json_encode($dark_mode_colors) . ');</script>'; 258 // Construct the $color_options array 259 $color_options = array( 260 'dark_mode_colors' => $dark_mode_colors, 261 'light_mode_colors' => $light_mode_colors, 262 'brand_colors' => $brand_colors 263 ); 264 265 // Update the options with the new color values 266 update_option('ele-ui-color-scheme-restoration-settings', $color_options); 267 //echo '<pre>'; 268 //var_dump($color_options); 269 //echo '</pre>'; 270 //wp_die(); 271 272 } 273 274 275 /** 276 * Reset options when reset is clicked. 277 * 278 * @access public 279 * @since 1.0.0 280 * @return void 281 */ 282 public function ele_ui_color_scheme_reset_colors() 283 { 284 285 ELEUICOLOR()->ele_ui_color_scheme_destroy_options(); 286 ELEUICOLOR()->ele_ui_color_scheme_create_options_with_defaults(); 287 } 288 // Function to convert RGB colors to hex format 289 public function ele_ui_color_scheme_rgbToHex($color) 290 { 291 $color = trim($color, 'rgba()'); // Remove 'rgba()' from the color string 292 $color = explode(',', $color); // Split the color into RGB components 293 $hex = '#'; 294 foreach ($color as $component) { 295 $component = intval($component); // Convert the component to integer 296 $hex .= str_pad(dechex($component), 2, '0', STR_PAD_LEFT); // Convert the component to hex and append to the final hex string 297 } 298 return $hex; 299 } 300 /** 301 * Reset options when reset is clicked. 302 * 303 * @access public 304 * @since 1.0.0 305 * @return void 306 */ 307 public function ele_ui_color_scheme_logger($variable) 308 { 309 echo '<script>console.log(' . json_encode($variable) . ');</script>'; 310 } 311 158 312 159 313 } -
ele-ui-color-scheme-restoration/trunk/core/includes/assets/css/backend-styles.css
r2924995 r2927586 1 /*-----------------2 Backend related CSS3 -----------------*/4 .elementor-add-section-button:hover {5 background-color: #93003c !important;6 color: #fff !important;7 }8 .elementor-editor-container-settings .elementor-editor-element-setting:first-child:before, .elementor-editor-section-settings .elementor-editor-element-setting:first-child:before{9 left: -20% !important;10 }11 .elementor-editor-widget-settings .elementor-editor-element-setting:hover {12 background-color: #10bcf2 !important;13 }14 .elementor-editor-column-settings .elementor-editor-element-setting:hover {15 background-color: #495157 !important;16 } -
ele-ui-color-scheme-restoration/trunk/ele-ui-color-scheme-restoration.php
r2924995 r2927586 6 6 * @author George Nicolaou & Atif Riaz 7 7 * @license gplv2 8 * @version 1.0.08 * @version 2.0.0 9 9 * 10 10 * @wordpress-plugin … … 12 12 * Plugin URI: https://www.georgenicolaou.me/plugins/ele-ui-color-scheme-restoration 13 13 * Description: A plugin that allows you to restore the Elementor UI back to the old colors 14 * Version: 1.0.014 * Version: 2.0.0 15 15 * Author: George Nicolaou & Atif Riaz 16 16 * Author URI: https://www.georgenicolaou.me/ … … 35 35 * 36 36 * The comment above contains all information about the plugin 37 * that are used by WordPress to differen ciate the plugin and register it properly.38 * It also contains further PHPDocs parameter for a better documentation37 * that are used by WordPress to differentiate the plugin and register it properly. 38 * It also contains further PHPDocs parameter for better documentation. 39 39 * 40 40 * The function ELEUICOLOR() is the main function that you will be able to … … 49 49 50 50 // Plugin version 51 define('ELEUICOLOR_VERSION', ' 1.0.0');51 define('ELEUICOLOR_VERSION', '2.0.0'); 52 52 53 53 // Plugin Root File … … 72 72 * of our master class. 73 73 * 74 * @author George Nicolaou75 * @since 1.0.076 74 * @return object|Ele_Ui_Color_Scheme_Restoration 77 75 */ 78 76 function ELEUICOLOR() 79 77 { 80 return Ele_Ui_Color_Scheme_Restoration::instance(); 81 } 82 83 84 function ele_ui_color_scheme_restoration_inline_styles() 85 { 86 $css_path = plugin_dir_path(__FILE__) . 'core/includes/assets/css/'; 87 88 // Get all CSS files in the directory and subdirectories 89 $css_files = glob($css_path . '*.min.css'); 90 $css_files = array_merge($css_files, glob($css_path . '*/**.css')); 91 92 // Loop through each CSS file and inline its contents 93 foreach ($css_files as $css_file) { 94 $css_contents = file_get_contents($css_file); 95 echo '<style>' . esc_html($css_contents) . '</style>'; 78 $plugin = Ele_Ui_Color_Scheme_Restoration::instance(); 79 80 return $plugin; 81 82 } 83 84 if (!function_exists('ele_ui_color_scheme_restoration_check_elementor')) { 85 function ele_ui_color_scheme_restoration_check_elementor() 86 { 87 return defined('ELEMENTOR_VERSION'); 96 88 } 97 89 } 98 90 99 add_action('wp_head', 'ele_ui_color_scheme_restoration_inline_styles', 999); 100 add_action('elementor/editor/after_enqueue_styles', 'ele_ui_color_scheme_restoration_customize_elementor_editor_styles'); 101 102 function ele_ui_color_scheme_restoration_customize_elementor_editor_styles() 103 { 104 $custom_styles = ' 105 106 .elementor-panel #elementor-panel-header { 107 background-color:#94003c; 91 function ele_ui_color_scheme_restoration_init() 92 { 93 if (ele_ui_color_scheme_restoration_check_elementor()) { 94 require_once ELEUICOLOR_PLUGIN_DIR . 'core/class-ele-ui-color-scheme-restoration.php'; 95 //ELEUICOLOR()->ele_ui_color_scheme_logger("Plugin Initialized..."); 96 97 98 // Check if the options exist and create them if they don't 99 if (!get_option('dark_mode_colors')) { 100 add_option('dark_mode_colors', array()); 101 //ELEUICOLOR()->ele_ui_color_scheme_logger("dark_mode_color created..."); 102 } 103 104 if (!get_option('light_mode_colors')) { 105 add_option('light_mode_colors', array()); 106 //ELEUICOLOR()->ele_ui_color_scheme_logger("light_mode_color created..."); 107 } 108 if (!get_option('brand_colors')) { 109 add_option('brand_colors', array()); 110 //ELEUICOLOR()->ele_ui_color_scheme_logger("light_mode_color created..."); 111 } 112 if (!get_option('ele-ui-color-scheme-restoration-settings')) { 113 add_option('ele-ui-color-scheme-restoration-settings', array()); 114 //ELEUICOLOR()->ele_ui_color_scheme_logger("ele-ui-color-scheme-restoration-settings created..."); 115 } 116 //ELEUICOLOR()->ele_ui_color_scheme_logger("Current Options State"); 117 //$current_light_colors = get_option('light_mode_colors'); 118 //$current_dark_colors = get_option('dark_mode_colors'); 119 //$current_ele_ui_color_scheme_restoration_settings = get_option('ele-ui-color-scheme-restoration-settings'); 120 //ELEUICOLOR()->ele_ui_color_scheme_logger($current_dark_colors); 121 //ELEUICOLOR()->ele_ui_color_scheme_logger($current_light_colors); 122 //ELEUICOLOR()->ele_ui_color_scheme_logger($current_ele_ui_color_scheme_restoration_settings); 123 124 return Ele_Ui_Color_Scheme_Restoration::instance(); 125 } else { 126 // Elementor is not installed or active, so we display an admin notice. 127 add_action('admin_notices', 'ele_ui_color_scheme_restoration_missing_elementor_notice'); 128 return; 108 129 } 109 .elementor-control-dynamic-switcher-wrapper { 110 background-color:#ccccccc; 130 } 131 add_action('plugins_loaded', 'ele_ui_color_scheme_restoration_init'); 132 133 function ele_ui_color_scheme_restoration_missing_elementor_notice() 134 { 135 $message = __('Ele UI Color Scheme Restoration requires the Elementor plugin to be installed and activated.', 'ele-ui-color-scheme-restoration'); 136 printf('<div class="notice notice-error is-dismissible"><p>%s</p></div>', esc_html($message)); 137 138 deactivate_plugins(plugin_basename(__FILE__)); 139 } 140 141 142 function ele_ui_color_scheme_restoration_enqueue_scripts() 143 { 144 // Enqueue Elementor color picker script 145 wp_enqueue_script('wp-color-picker'); 146 wp_enqueue_style('wp-color-picker'); 147 148 // Inline script to initialize the color picker 149 wp_add_inline_script('wp-color-picker', ' 150 jQuery(document).ready(function($) { 151 $(".color-picker").wpColorPicker(); 152 }); 153 '); 154 155 wp_add_inline_script('jquery', ' 156 window.addEventListener("DOMContentLoaded", function(e) { 157 document.querySelectorAll("input[type=color]").forEach(function(current) { 158 let newEl = document.createElement("input"); 159 newEl.size = 8; 160 newEl.value = current.value; 161 newEl.pattern = "#[0-9A-Fa-f]{6}"; 162 newEl.style.marginLeft = "0.5em"; 163 164 current.insertAdjacentElement("afterend", newEl); 165 166 newEl.addEventListener("input", function(e) { 167 if(e.target.validity.valid) { 168 current.value = e.target.value; 169 } 170 }); 171 172 current.addEventListener("change", function(e) { 173 newEl.value = e.target.value; 174 }); 175 }); 176 }); 177 '); 178 } 179 add_action('admin_enqueue_scripts', 'ele_ui_color_scheme_restoration_enqueue_scripts'); 180 181 182 183 /** 184 * Register the options page 185 */ 186 function ele_ui_color_scheme_register_options_page() 187 { 188 add_menu_page( 189 'Ele UI Color Scheme Restoration', 190 'Ele UI Color Scheme', 191 'manage_options', 192 'ele-ui-color-scheme', 193 'ele_ui_color_scheme_render_options_page', 194 'dashicons-admin-generic', 195 99 196 ); 197 } 198 add_action('admin_menu', 'ele_ui_color_scheme_register_options_page'); 199 200 201 202 // Check if the reset colors button is clicked 203 if (isset($_POST['reset_colors'])) { 204 // Check if the options exist and create them if they don't 205 if (!get_option('dark_mode_colors')) { 206 add_option('dark_mode_colors', array()); 111 207 } 112 #elementor-panel-elements-search-area { 113 background-color: #e7e9ec; 208 209 if (!get_option('light_mode_colors')) { 210 add_option('light_mode_colors', array()); 114 211 } 115 .elementor-panel .elementor-element { 116 background-color:#ffffff; 212 213 if (!get_option('brand_colors')) { 214 add_option('brand_colors', array()); 117 215 } 118 .elementor-panel { 119 background-color: #e7e9ec; 216 // Call the reset colors function 217 ELEUICOLOR()->ele_ui_color_scheme_reset_colors(); 218 } 219 /** 220 * Render the options page 221 */ 222 function ele_ui_color_scheme_render_options_page() 223 { 224 // Check if the form has been submitted and update the options if needed 225 if (isset($_POST['reset_colors'])) { 226 ELEUICOLOR()->ele_ui_color_scheme_reset_colors(); 227 } elseif (isset($_POST['save_colors'])) { 228 ELEUICOLOR()->ele_ui_color_scheme_save_colors(); 229 120 230 } 121 main#elementor-panel-content-wrapper * { 122 border-color: #cccccc; 123 color: black; 231 232 // Retrieve the saved color options 233 $color_options = get_option('ele-ui-color-scheme-restoration-settings', array()); 234 //var_dump($color_options); 235 //wp_die(); 236 //ELEUICOLOR()->ele_ui_color_scheme_logger($color_options); 237 ?> 238 <div class="wrap"> 239 <h1> 240 <?php _e('Ele UI Color Scheme Restoration Settings', 'ele-ui-color-scheme-restoration'); ?> 241 </h1> 242 <form method="post" action=""> 243 244 <table class="widefat striped"> 245 <thead> 246 <tr> 247 <th> 248 <?php _e('Primary Brand Color', 'ele-ui-color-scheme-restoration'); ?> 249 </th> 250 <th> 251 <?php _e('Brand Hover Color', 'ele-ui-color-scheme-restoration'); ?> 252 </th> 253 <th> 254 <?php _e('Brand Active Border Color', 'ele-ui-color-scheme-restoration'); ?> 255 </th> 256 </tr> 257 </thead> 258 <tbody> 259 <tr> 260 <td> 261 <a target="_blank" 262 href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '18.png'; ?>" 263 class="eleui-image"> 264 Show me 265 </a> 266 <input type="color" name="brand_colors[--brand-color]" 267 value="<?php echo esc_attr(strval($color_options['brand_colors']['--brand-color'])); ?>"> 268 </td> 269 <td> 270 <a target="_blank" 271 href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '19.png'; ?>" 272 class="eleui-image"> 273 Show me 274 </a> 275 <input type="color" name="brand_colors[--brand-color-hover]" 276 value="<?php echo esc_attr(strval($color_options['brand_colors']['--brand-color-hover'])); ?>"> 277 </td> 278 <td> 279 <a target="_blank" 280 href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '20.png'; ?>" 281 class="eleui-image"> 282 Show me 283 </a> 284 <input type="color" name="brand_colors[--brand-color-active]" 285 value="<?php echo esc_attr(strval($color_options['brand_colors']['--brand-color-active'])); ?>"> 286 </td> 287 </tr> 288 </tbody> 289 </table> 290 291 <table class="widefat striped"> 292 <thead> 293 <tr> 294 <th> 295 <?php _e('Where', 'ele-ui-color-scheme-restoration'); ?> 296 </th> 297 <th> 298 <?php _e('Dark Mode', 'ele-ui-color-scheme-restoration'); ?> 299 </th> 300 <th> 301 <?php _e('Light Mode', 'ele-ui-color-scheme-restoration'); ?> 302 </th> 303 </tr> 304 </thead> 305 <tbody> 306 <tr> 307 <td> 308 <?php _e('Editor Background', 'ele-ui-color-scheme-restoration'); ?> 309 <a target="_blank" 310 href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '1.png'; ?>" 311 class="eleui-image"> 312 Show me 313 </a> 314 </td> 315 <td> 316 <input type="color" name="dark_mode[--e-a-bg-default]" 317 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-bg-default'])); ?>"> 318 </td> 319 <td> 320 <input type="color" name="light_mode[--e-a-bg-default]" 321 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-bg-default'])); ?>"> 322 </td> 323 </tr> 324 <tr> 325 <tr> 326 <td> 327 <?php _e('Header and Footer Areas', 'ele-ui-color-scheme-restoration'); ?> 328 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '2.png'; ?>" 329 class="eleui-image"> 330 Show me 331 </a> 332 </td> 333 <td> 334 <input type="color" name="dark_mode[--e-a-dark-bg]" 335 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-dark-bg'])); ?>"> 336 </td> 337 <td> 338 <input type="color" name="light_mode[--e-a-dark-bg]" 339 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-dark-bg'])); ?>"> 340 </td> 341 </tr> 342 <tr> 343 <td> 344 <?php _e('Header and Footer Text Color', 'ele-ui-color-scheme-restoration'); ?> 345 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '3.png'; ?>" 346 class="eleui-image"> 347 Show me 348 </a> 349 </td> 350 <td> 351 <input type="color" name="dark_mode[--e-a-dark-color-txt]" 352 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-dark-color-txt'])); ?>"> 353 </td> 354 <td> 355 <input type="color" name="light_mode[--e-a-dark-color-txt]" 356 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-dark-color-txt'])); ?>"> 357 </td> 358 </tr> 359 360 361 362 <tr> 363 <td> 364 <?php _e('Header and Footer Text Color (Hover)', 'ele-ui-color-scheme-restoration'); ?> 365 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '4.png'; ?>" 366 class="eleui-image"> 367 Show me 368 </a> 369 </td> 370 <td> 371 <input type="color" name="dark_mode[--e-a-dark-color-txt-hover]" 372 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-dark-color-txt-hover'])); ?>"> 373 </td> 374 <td> 375 <input type="color" name="light_mode[--e-a-dark-color-txt-hover]" 376 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-dark-color-txt-hover'])); ?>"> 377 </td> 378 </tr> 379 380 381 382 383 <tr> 384 <td> 385 <?php _e('Update Button and Toggles', 'ele-ui-color-scheme-restoration'); ?> 386 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '5.png'; ?>" 387 class="eleui-image"> 388 Show me 389 </a> 390 </td> 391 <td> 392 <input type="color" name="dark_mode[--e-a-btn-bg-primary]" 393 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-btn-bg-primary'])); ?>"> 394 </td> 395 <td> 396 <input type="color" name="light_mode[--e-a-btn-bg-primary]" 397 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-btn-bg-primary'])); ?>"> 398 </td> 399 </tr> 400 401 402 <tr> 403 <td> 404 <?php _e('Update Button and Toggles (Hover)', 'ele-ui-color-scheme-restoration'); ?> 405 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '6.png'; ?>" 406 class="eleui-image"> 407 Show me 408 </a> 409 </td> 410 <td> 411 <input type="color" name="dark_mode[--e-a-btn-bg-primary-hover]" 412 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-btn-bg-primary-hover'])); ?>"> 413 </td> 414 <td> 415 <input type="color" name="light_mode[--e-a-btn-bg-primary-hover]" 416 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-btn-bg-primary-hover'])); ?>"> 417 </td> 418 </tr> 419 420 <tr> 421 <td> 422 <?php _e('Update Button and Toggles (Active)', 'ele-ui-color-scheme-restoration'); ?> 423 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '7.png'; ?>" 424 class="eleui-image"> 425 Show me 426 </a> 427 </td> 428 <td> 429 <input type="color" name="dark_mode[--e-a-btn-bg-primary-active]" 430 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-btn-bg-primary-active'])); ?>"> 431 </td> 432 <td> 433 <input type="color" name="light_mode[--e-a-btn-bg-primary-active]" 434 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-btn-bg-primary-active'])); ?>"> 435 </td> 436 </tr> 437 438 439 440 <tr> 441 <td> 442 <?php _e('Widget Colors On Hover', 'ele-ui-color-scheme-restoration'); ?> 443 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '8.png'; ?>" 444 class="eleui-image"> 445 Show me 446 </a> 447 </td> 448 <td> 449 <input type="color" name="dark_mode[--e-a-bg-hover]" 450 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-bg-hover'])); ?>"> 451 </td> 452 <td> 453 <input type="color" name="light_mode[--e-a-bg-hover]" 454 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-bg-hover'])); ?>"> 455 </td> 456 </tr> 457 458 459 460 461 462 <tr> 463 <td> 464 <?php _e('Widget Colors On Hover (Active)', 'ele-ui-color-scheme-restoration'); ?> 465 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '9.png'; ?>" 466 class="eleui-image"> 467 Show me 468 </a> 469 </td> 470 <td> 471 <input type="color" name="dark_mode[--e-a-bg-active]" 472 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-bg-active'])); ?>"> 473 </td> 474 <td> 475 <input type="color" name="light_mode[--e-a-bg-active]" 476 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-bg-active'])); ?>"> 477 </td> 478 </tr> 479 480 481 482 483 <tr> 484 <tr> 485 <td> 486 <?php _e('Widget Border Color', 'ele-ui-color-scheme-restoration'); ?> 487 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '10.png'; ?>" 488 class="eleui-image"> 489 Show me 490 </a> 491 </td> 492 <td> 493 <input type="color" name="dark_mode[--e-a-border-color]" 494 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-border-color'])); ?>"> 495 </td> 496 <td> 497 <input type="color" name="light_mode[--e-a-border-color]" 498 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-border-color'])); ?>"> 499 </td> 500 </tr> 501 <tr> 502 <td> 503 <?php _e('Search In Focus', 'ele-ui-color-scheme-restoration'); ?> 504 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '11.png'; ?>" 505 class="eleui-image"> 506 Show me 507 </a> 508 </td> 509 <td> 510 <input type="color" name="dark_mode[--e-a-border-color-focus]" 511 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-border-color-focus'])); ?>"> 512 </td> 513 <td> 514 <input type="color" name="light_mode[--e-a-border-color-focus]" 515 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-border-color-focus'])); ?>"> 516 </td> 517 </tr> 518 <tr> 519 <td> 520 <?php _e('Text Selector Background Color', 'ele-ui-color-scheme-restoration'); ?> 521 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '12.png'; ?>" 522 class="eleui-image"> 523 Show me 524 </a> 525 </td> 526 <td> 527 <input type="color" name="dark_mode[--e-a-bg-primary]" 528 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-bg-primary'])); ?>"> 529 </td> 530 <td> 531 <input type="color" name="light_mode[--e-a-bg-primary]" 532 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-bg-primary'])); ?>"> 533 </td> 534 </tr> 535 <tr> 536 <td> 537 <?php _e('Text Color', 'ele-ui-color-scheme-restoration'); ?> 538 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '13.png'; ?>" 539 class="eleui-image"> 540 Show me 541 </a> 542 </td> 543 <td> 544 <input type="color" name="dark_mode[--e-a-color-txt]" 545 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-color-txt'])); ?>"> 546 </td> 547 <td> 548 <input type="color" name="light_mode[--e-a-color-txt]" 549 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-color-txt'])); ?>"> 550 </td> 551 </tr> 552 <tr> 553 <td> 554 <?php _e('Link Hover and Global Style Active Icon Color', 'ele-ui-color-scheme-restoration'); ?> 555 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '14.png'; ?>" 556 class="eleui-image"> 557 Show me 558 </a> 559 </td> 560 <td> 561 <input type="color" name="dark_mode[--e-a-color-primary-bold]" 562 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-color-primary-bold'])); ?>"> 563 </td> 564 <td> 565 <input type="color" name="light_mode[--e-a-color-primary-bold]" 566 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-color-primary-bold'])); ?>"> 567 </td> 568 </tr> 569 <tr> 570 <td> 571 <?php _e('Info Link Color', 'ele-ui-color-scheme-restoration'); ?> 572 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '15.png'; ?>" 573 class="eleui-image"> 574 Show me 575 </a> 576 </td> 577 <td> 578 <input type="color" name="dark_mode[--e-a-color-info]" 579 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-color-info'])); ?>"> 580 </td> 581 <td> 582 <input type="color" name="light_mode[--e-a-color-info]" 583 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-color-info'])); ?>"> 584 </td> 585 </tr> 586 <tr> 587 <td> 588 <?php _e('Border Color in Widget Elements', 'ele-ui-color-scheme-restoration'); ?> 589 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '16.png'; ?>" 590 class="eleui-image"> 591 Show me 592 </a> 593 </td> 594 <td> 595 <input type="color" name="dark_mode[--e-a-border-color-bold]" 596 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-border-color-bold'])); ?>"> 597 </td> 598 <td> 599 <input type="color" name="light_mode[--e-a-border-color-bold]" 600 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-border-color-bold'])); ?>"> 601 </td> 602 </tr> 603 <tr> 604 <td> 605 <?php _e('Selected Controls in Widget Editor - Background Color', 'ele-ui-color-scheme-restoration'); ?> 606 <a href="<?php echo esc_attr('/wp-content/plugins/ele-ui-color-scheme-restoration/core/includes/assets/images/') . '17.png'; ?>" 607 class="eleui-image"> 608 Show me 609 </a> 610 </td> 611 <td> 612 <input type="color" name="dark_mode[--e-a-bg-active-bold]" 613 value="<?php echo esc_attr(strval($color_options['dark_mode_colors']['--e-a-bg-active-bold'])); ?>"> 614 </td> 615 <td> 616 <input type="color" name="light_mode[--e-a-bg-active-bold]" 617 value="<?php echo esc_attr(strval($color_options['light_mode_colors']['--e-a-bg-active-bold'])); ?>"> 618 </td> 619 </tr> 620 </tbody> 621 </table> 622 <p class="submit"> 623 <input type="submit" name="save_colors" class="button-primary" 624 value="<?php _e('Save Colors', 'ele-ui-color-scheme-restoration'); ?>"> 625 <input type="submit" name="reset_colors" class="button-secondary" 626 value="<?php _e('Reset Colors', 'ele-ui-color-scheme-restoration'); ?>"> 627 </p> 628 </form> 629 </div> 630 <?php 631 } 632 633 634 /** 635 * Register the settings 636 */ 637 function ele_ui_color_scheme_register_settings() 638 { 639 register_setting( 640 'ele-ui-color-scheme-settings', 641 'ele-ui-color-scheme-restoration-settings', 642 'ele_ui_color_scheme_sanitize_settings' 643 ); 644 645 add_settings_section( 646 'ele-ui-color-scheme-section', 647 'Color Scheme Settings', 648 'ele_ui_color_scheme_render_section', 649 'ele-ui-color-scheme-settings' 650 ); 651 652 add_settings_field( 653 'color-scheme-option', 654 'Color Scheme Option', 655 'ele_ui_color_scheme_render_color_scheme_option', 656 'ele-ui-color-scheme-settings', 657 'ele-ui-color-scheme-section' 658 ); 659 } 660 add_action('admin_init', 'ele_ui_color_scheme_register_settings'); 661 662 /** 663 * Sanitize settings 664 */ 665 function ele_ui_color_scheme_sanitize_settings($settings) 666 { 667 // Perform any necessary sanitization/validation 668 return $settings; 669 } 670 671 /** 672 * Render the settings section 673 */ 674 function ele_ui_color_scheme_render_section() 675 { 676 // Output section description if needed 677 } 678 679 /** 680 * Render the color scheme option field 681 */ 682 function ele_ui_color_scheme_render_color_scheme_option() 683 { 684 // Output the HTML for your color scheme option input field 685 } 686 687 688 689 /* Editor in Dark Mode*/ 690 $all_colors = get_option('ele-ui-color-scheme-restoration-settings'); 691 //$all_colors['dark_mode_colors'] = get_option('dark_mode_colors'); 692 //echo '<pre>'; 693 694 //var_dump($all_colors); 695 //echo '</pre>'; 696 //wp_die(); 697 add_action('elementor/editor/wp_head', function () { 698 $all_colors = get_option('ele-ui-color-scheme-restoration-settings'); 699 //ELEUICOLOR()->ele_ui_color_scheme_logger($all_colors['dark_mode_colors']); 700 $style = '<style> 701 .elementor-panel 702 #elementor-panel-saver-button-publish:not(.elementor-disabled) { 703 border-color: currentColor; 704 } 705 @media (prefers-color-scheme: dark) { 706 :root { 707 color-scheme: dark; 708 709 /* start editing here*/ 710 711 /* Editor Background */ 712 --e-a-bg-default: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-bg-default']) . '; 713 714 715 /* Header and Footer Areas*/ 716 --e-a-dark-bg: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-dark-bg']) . '; 717 --e-a-dark-color-txt: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-dark-color-txt']) . '; 718 --e-a-dark-color-txt-hover: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-dark-color-txt-hover']) . '; 719 720 721 /* Update Button and toggles */ 722 --e-a-btn-bg-primary: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-btn-bg-primary']) . '; 723 --e-a-btn-bg-primary-hover: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-btn-bg-primary-hover']) . '; 724 --e-a-btn-bg-primary-active: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-btn-bg-primary-active']) . '; 725 726 727 /* Widget Colors On Hover - Note widget colors same as background colors by default */ 728 --e-a-bg-hover: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-bg-hover']) . '; 729 --e-a-bg-active: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-bg-active']) . '; 730 731 732 /* Widget Border Color */ 733 --e-a-border-color: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-border-color']) . '; 734 735 736 /* Search In Focus */ 737 --e-a-border-color-focus: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-border-color-focus']) . '; 738 739 740 /* Text Selector Background Color */ 741 --e-a-bg-primary: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-bg-primary']) . '; 742 743 744 /* text color */ 745 --e-a-color-txt: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-color-txt']) . '; 746 747 748 /* Link Hover and Global Style Active Icon Color */ 749 --e-a-color-primary-bold: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-color-primary-bold']) . '; 750 751 752 /* Info Link Color*/ 753 --e-a-color-info: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-color-info']) . '; 754 755 756 /* Border Color in Widget Elements*/ 757 --e-a-border-color-bold: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-border-color-bold']) . '; 758 759 760 /* Selected Controls in Widget Editor - background color */ 761 --e-a-bg-active-bold: ' . sanitize_hex_color($all_colors['dark_mode_colors']['--e-a-bg-active-bold']) . '; 762 763 } 124 764 } 125 .elementor-control.elementor-control-separator-default { 126 border-top: solid 1px gray; 127 padding: 15px 20px; 128 } 129 .elementor-control-dimension-label { 130 color: black !important; 131 } 132 .elementor-panel #elementor-panel-saver-button-publish:not(.elementor-disabled) { 133 background-color: green; 134 color: white; 135 } 136 .elementor-button.e-primary { 137 background-color: green; 138 color: white; 139 } 140 141 #elementor-panel-saver-button-publish 142 { 143 background-color: green; 144 color: white; 145 } 146 147 #elementor-panel-saver-button-save-options:hover 148 { 149 background-color: green; 150 color: white; 151 } 152 153 154 button.e-primary:hover { 155 background-color: #e7e9ec; 156 color: white; 157 } 158 .elementor-panel #elementor-panel-saver-button-publish:not(.elementor-disabled) { 159 -webkit-border-end: 1px solid #3A3F45; 160 border-inline-end:1px solid #3A3F45; 161 } 162 '; 163 wp_add_inline_style('elementor-editor', $custom_styles); 164 } 165 166 167 168 765 </style>'; 766 767 echo $style; 768 }, 100); 769 770 /* Editor in Light Mode*/ 771 772 add_action('elementor/editor/wp_head', function () { 773 $all_colors = get_option('ele-ui-color-scheme-restoration-settings'); 774 //echo '<pre>' . var_dump($all_colors) . '<pre>'; 775 //wp_die(); 776 echo '<style> 777 .elementor-panel 778 #elementor-panel-saver-button-publish:not(.elementor-disabled) { 779 border-color: currentColor; 780 } 781 @media (prefers-color-scheme: light) { 782 :root { 783 color-scheme: light; 784 785 /* start editing here*/ 786 787 /* Editor Background */ 788 --e-a-bg-default: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-bg-default']) . '; 789 790 791 /* Header and Footer Areas*/ 792 --e-a-dark-bg: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-dark-bg']) . '; 793 --e-a-dark-color-txt: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-dark-color-txt']) . '; 794 --e-a-dark-color-txt-hover: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-dark-color-txt-hover']) . '; 795 796 797 /* Update Button and toggles */ 798 --e-a-btn-bg-primary: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-btn-bg-primary']) . '; 799 --e-a-btn-bg-primary-hover: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-btn-bg-primary-hover']) . '; 800 --e-a-btn-bg-primary-active: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-btn-bg-primary-active']) . '; 801 802 803 /* Widget Colors On Hover - Note widget colors same as background colors by default */ 804 --e-a-bg-hover: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-bg-hover']) . '; 805 --e-a-bg-active: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-bg-active']) . '; 806 807 808 /* Widget Border Color */ 809 --e-a-border-color: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-border-color']) . '; 810 811 812 /* Search In Focus */ 813 --e-a-border-color-focus: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-border-color-focus']) . '; 814 815 816 /* Text Selector Background Color */ 817 --e-a-bg-primary: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-bg-primary']) . '; 818 819 820 /* text color */ 821 --e-a-color-txt: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-color-txt']) . '; 822 823 824 /* Link Hover and Global Style Active Icon Color */ 825 --e-a-color-primary-bold: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-color-primary-bold']) . '; 826 827 828 /* Info Link Color*/ 829 --e-a-color-info: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-color-info']) . '; 830 831 832 /* Border Color in Widget Elements*/ 833 --e-a-border-color-bold: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-border-color-bold']) . '; 834 835 836 /* Selected Controls in Widget Editor - background color */ 837 --e-a-bg-active-bold: ' . sanitize_hex_color($all_colors['light_mode_colors']['--e-a-bg-active-bold']) . '; 838 839 } 840 } 841 842 } 843 </style>'; 844 }, 100); 845 846 add_action('elementor/preview/enqueue_styles', function () { 847 $all_colors = get_option('ele-ui-color-scheme-restoration-settings'); 848 echo '<style> 849 :root { 850 /* Edit Here */ 851 852 /* Primary Color */ 853 --brand-color: ' . sanitize_hex_color($all_colors['brand_colors']['--brand-color']) . '; 854 855 /* Hover Color */ 856 --brand-color-hover: ' . sanitize_hex_color($all_colors['brand_colors']['--brand-color-hover']) . '; 857 858 /* Active Border Color */ 859 --brand-color-active: ' . sanitize_hex_color($all_colors['brand_colors']['--brand-color-active']) . '; 860 861 862 /* do not edit below */ 863 864 --e-p-draggable-color: var(--brand-color) !important; 865 --e-p-border-column: var(--brand-color) !important; 866 --e-p-border-column-hover: var(--brand-color-hover) !important; 867 --e-p-border-column-invert: #0c0d0e !important; 868 --e-p-border-section: var(--brand-color) !important; 869 --e-p-border-section-hover: var(--brand-color-hover) !important; 870 --e-p-border-section-invert: #0c0d0e !important; 871 --e-p-border-con: var(--brand-color) !important; 872 --e-p-border-con-hover: var(--brand-color-hover) !important; 873 --e-p-border-con-active: var(--brand-color-active) !important; 874 --e-p-border-con-invert: #0c0d0e !important; 875 --e-p-border-widget: var(--brand-color) !important; 876 --e-p-border-widget-hover: var(--brand-color-hover) !important; 877 --e-p-border-widget-active: var(--brand-color-active) !important; 878 --e-p-border-widget-invert: #0c0d0e !important; 879 --e-a-btn-bg-primary: var(--brand-color) !important; 880 --e-a-btn-bg-primary-hover: var(--brand-color-hover) !important; 881 --e-a-btn-bg-primary-active: var(--brand-color-active) !important; 882 } 883 </style>'; 884 }, 999999999999999999999); 169 885 ELEUICOLOR(); -
ele-ui-color-scheme-restoration/trunk/readme.txt
r2925004 r2927586 4 4 Donate link: 5 5 Contributors: orionaselite,lightbulbman 6 Tags: 6 Tags: elementor,ui 7 7 Requires at least: 8 8 Tested up to: 6.2 … … 12 12 License URI: https://www.gnu.org/licenses/gpl-2.0.html 13 13 14 A plugin that allows you to restore the Elementor UI back to the old colors14 A plugin that allows you to store the Elementor UI back to the old colors 15 15 16 16 == Description == … … 54 54 4. Click on `Activate plugin` 55 55 56 == Screenshots == 57 58 1. Define Your Desired Settings 59 60 56 61 == Changelog == 57 62 58 63 = 1.0.0: April 8, 2023 = 59 64 * Birthday of Ele UI Color Scheme Restoration 65 66 = 2.0.0: June 18, 2023 = 67 * Removed loads of redundent legacy code that made the plugin slow 68 * Added 20 options to allow the suer to style their entire Elemntor UI 69 * Made sure options are deleted when plugin is uninstalled 70 * added a check to make sure users are actually using Elementor the plugin will not activate if you are not using elementor 71 * Options UI allows user to reset their colors to what the plugin considers default
Note: See TracChangeset
for help on using the changeset viewer.