| @@ -27,8 +27,14 @@ | ||
| 27 | 27 | { |
| 28 | 28 | Darkify::createSection( |
| 29 | 29 | $prefix, |
| 30 | 30 | array( |
| 31 | + // Explicit, locale-independent id. Without it the REST layer falls | |
| 32 | + // back to sanitize_title() of the *translated* title, so the route | |
| 33 | + // became #/sterowanie on a Polish site and every link 404'd inside | |
| 34 | + // the SPA. Value matches the old English slug so existing | |
| 35 | + // `#tab=` / `#/controls` bookmarks keep resolving. | |
| 36 | + 'id' => 'controls', | |
| 31 | 37 | 'title' => esc_html__('Controls', 'darkify'), |
| 32 | 38 | 'icon' => 'icofont-ui-settings', |
| 33 | 39 | 'fields' => array( |
| 34 | 40 | array( |
| @@ -35,8 +41,9 @@ | ||
| 35 | 41 | 'type' => 'section_tab', |
| 36 | 42 | 'tabs' => array( |
| 37 | 43 | |
| 38 | 44 | array( |
| 45 | + 'id' => 'frontend', | |
| 39 | 46 | 'title' => esc_html__('Frontend', 'darkify'), |
| 40 | 47 | 'icon' => 'icofont-computer', |
| 41 | 48 | 'fields' => array( |
| 42 | 49 | // Intro line with a docs link, rendered plain above the section cards. |
| @@ -225,8 +232,9 @@ | ||
| 225 | 232 | ), |
| 226 | 233 | ), |
| 227 | 234 | ), |
| 228 | 235 | array( |
| 236 | + 'id' => 'admin', | |
| 229 | 237 | 'title' => esc_html__('Admin', 'darkify'), |
| 230 | 238 | 'icon' => 'icofont-dashboard-web', |
| 231 | 239 | 'fields' => array( |
| 232 | 240 | // Intro line with a docs link, rendered plain above the section cards. |
| @@ -261,9 +269,115 @@ | ||
| 261 | 269 | // Commit instantly even though other fields depend on it. |
| 262 | 270 | 'auto_save' => true, |
| 263 | 271 | ), |
| 264 | 272 | |
| 273 | + /* | |
| 274 | + * Admin palettes are separate from the frontend's `color_pallets` | |
| 275 | + * and from each other. wp-admin is rendered by Dark Reader, which | |
| 276 | + * derives a colour per source colour; a preset overrides only the | |
| 277 | + * page background and text colour and lets it derive the rest. | |
| 278 | + * | |
| 279 | + * "Auto" is the default and the recommended value: pinning those two | |
| 280 | + * flattens distinctions the derivation would otherwise keep, which | |
| 281 | + * matters most on admin screens built by other plugins. | |
| 282 | + * | |
| 283 | + * Only the five presets darkify_apply_palette() actually defines are | |
| 284 | + * listed. The block editor's toolbar dropdown offers more than that | |
| 285 | + * and silently falls back for the rest — do not copy that list here. | |
| 286 | + * | |
| 287 | + * The swatch colours match the toolbar dropdown (.darkify-dropdown in | |
| 288 | + * src/assets/css/client_main.css) so the same preset is recognisable | |
| 289 | + * in both places. "Auto" shows a gradient: it has no single colour. | |
| 290 | + * | |
| 291 | + * These are the site-wide default. The editor's toolbar dropdown | |
| 292 | + * still writes a per-user choice to localStorage, which wins for | |
| 293 | + * that user — the same relationship the toolbar has always had. | |
| 294 | + */ | |
| 265 | 295 | array( |
| 296 | + 'id' => 'admin_panel_palette', | |
| 297 | + 'type' => 'select', | |
| 298 | + 'title' => esc_html__('Admin Panel Palette', 'darkify'), | |
| 299 | + 'title_help' => | |
| 300 | + '<div class="darkify-info-label">' . | |
| 301 | + __('Color preset for the WordPress admin. Auto lets Darkify derive each color from the original.', 'darkify') . | |
| 302 | + '</div>', | |
| 303 | + 'default' => 'auto', | |
| 304 | + 'options' => array( | |
| 305 | + 'auto' => array( | |
| 306 | + 'text' => esc_html__('Auto (recommended)', 'darkify'), | |
| 307 | + 'swatch' => 'linear-gradient(135deg, #0f0f0f 0%, #3a3a3a 50%, #8f8f8f 100%)', | |
| 308 | + ), | |
| 309 | + 'set1' => array( | |
| 310 | + 'text' => esc_html__('Carbon Mist', 'darkify'), | |
| 311 | + 'swatch' => '#171717', | |
| 312 | + ), | |
| 313 | + 'set3' => array( | |
| 314 | + 'text' => esc_html__('Midnight Reverie', 'darkify'), | |
| 315 | + 'swatch' => '#4e478d', | |
| 316 | + ), | |
| 317 | + 'set9' => array( | |
| 318 | + 'text' => esc_html__('Verdant Depths', 'darkify'), | |
| 319 | + 'swatch' => '#073d2f', | |
| 320 | + ), | |
| 321 | + 'set6' => array( | |
| 322 | + 'text' => esc_html__('Celestial Tide', 'darkify'), | |
| 323 | + 'swatch' => '#144e78', | |
| 324 | + ), | |
| 325 | + 'set10' => array( | |
| 326 | + 'text' => esc_html__('Emberwood', 'darkify'), | |
| 327 | + 'swatch' => '#372911', | |
| 328 | + ), | |
| 329 | + | |
| 330 | + /* | |
| 331 | + * Pro presets, listed after every one that works here so the | |
| 332 | + * usable list is not diluted at the top. | |
| 333 | + * | |
| 334 | + * These are not new upsell surface. The block editor's toolbar | |
| 335 | + * dropdown has always offered all eleven names while | |
| 336 | + * darkify_apply_palette() defines only five, so picking one of | |
| 337 | + * these silently rendered Carbon Mist — they looked broken | |
| 338 | + * rather than gated. Marking them is what makes that honest. | |
| 339 | + * | |
| 340 | + * `pro_only` is the whole mechanism: locked_option_keys() turns | |
| 341 | + * it into the `pro_options` stamp the React admin renders as a | |
| 342 | + * disabled, badged row, and strip_pro_keys() refuses to persist | |
| 343 | + * the value even if a crafted request sends it. | |
| 344 | + */ | |
| 345 | + 'set2' => array( | |
| 346 | + 'text' => esc_html__('Glacier Drift', 'darkify'), | |
| 347 | + 'swatch' => '#123d52', | |
| 348 | + 'pro_only' => true, | |
| 349 | + ), | |
| 350 | + 'set4' => array( | |
| 351 | + 'text' => esc_html__('Indigo Veil', 'darkify'), | |
| 352 | + 'swatch' => '#46598c', | |
| 353 | + 'pro_only' => true, | |
| 354 | + ), | |
| 355 | + 'set5' => array( | |
| 356 | + 'text' => esc_html__('Duskmire', 'darkify'), | |
| 357 | + 'swatch' => '#403953', | |
| 358 | + 'pro_only' => true, | |
| 359 | + ), | |
| 360 | + 'set7' => array( | |
| 361 | + 'text' => esc_html__('Tidal Frost', 'darkify'), | |
| 362 | + 'swatch' => '#286f8d', | |
| 363 | + 'pro_only' => true, | |
| 364 | + ), | |
| 365 | + 'set8' => array( | |
| 366 | + 'text' => esc_html__('Blue Bastion', 'darkify'), | |
| 367 | + 'swatch' => '#244892', | |
| 368 | + 'pro_only' => true, | |
| 369 | + ), | |
| 370 | + 'set11' => array( | |
| 371 | + 'text' => esc_html__('Crimson Veil', 'darkify'), | |
| 372 | + 'swatch' => '#440649', | |
| 373 | + 'pro_only' => true, | |
| 374 | + ), | |
| 375 | + ), | |
| 376 | + 'dependency' => array('enable_admin_panel_dark_mode', '==', 'true'), | |
| 377 | + ), | |
| 378 | + | |
| 379 | + array( | |
| 266 | 380 | 'id' => 'block_editor_dark_mode', |
| 267 | 381 | 'type' => 'switcher', |
| 268 | 382 | 'title' => esc_html__('Block Editor Dark Mode', 'darkify'), |
| 269 | 383 | 'title_help' => |
| @@ -276,8 +390,92 @@ | ||
| 276 | 390 | 'text_off' => esc_html__('Disabled', 'darkify'), |
| 277 | 391 | 'default' => false, |
| 278 | 392 | 'text_width' => 100, |
| 279 | 393 | ), |
| 394 | + array( | |
| 395 | + 'id' => 'block_editor_palette', | |
| 396 | + 'type' => 'select', | |
| 397 | + 'title' => esc_html__('Block Editor Palette', 'darkify'), | |
| 398 | + 'title_help' => | |
| 399 | + '<div class="darkify-info-label">' . | |
| 400 | + __('Color preset for the block editor, independent of the rest of the admin.', 'darkify') . | |
| 401 | + '</div>', | |
| 402 | + 'default' => 'auto', | |
| 403 | + 'options' => array( | |
| 404 | + 'auto' => array( | |
| 405 | + 'text' => esc_html__('Auto (recommended)', 'darkify'), | |
| 406 | + 'swatch' => 'linear-gradient(135deg, #0f0f0f 0%, #3a3a3a 50%, #8f8f8f 100%)', | |
| 407 | + ), | |
| 408 | + 'set1' => array( | |
| 409 | + 'text' => esc_html__('Carbon Mist', 'darkify'), | |
| 410 | + 'swatch' => '#171717', | |
| 411 | + ), | |
| 412 | + 'set3' => array( | |
| 413 | + 'text' => esc_html__('Midnight Reverie', 'darkify'), | |
| 414 | + 'swatch' => '#4e478d', | |
| 415 | + ), | |
| 416 | + 'set9' => array( | |
| 417 | + 'text' => esc_html__('Verdant Depths', 'darkify'), | |
| 418 | + 'swatch' => '#073d2f', | |
| 419 | + ), | |
| 420 | + 'set6' => array( | |
| 421 | + 'text' => esc_html__('Celestial Tide', 'darkify'), | |
| 422 | + 'swatch' => '#144e78', | |
| 423 | + ), | |
| 424 | + 'set10' => array( | |
| 425 | + 'text' => esc_html__('Emberwood', 'darkify'), | |
| 426 | + 'swatch' => '#372911', | |
| 427 | + ), | |
| 428 | + | |
| 429 | + /* | |
| 430 | + * Pro presets, listed after every one that works here so the | |
| 431 | + * usable list is not diluted at the top. | |
| 432 | + * | |
| 433 | + * These are not new upsell surface. The block editor's toolbar | |
| 434 | + * dropdown has always offered all eleven names while | |
| 435 | + * darkify_apply_palette() defines only five, so picking one of | |
| 436 | + * these silently rendered Carbon Mist — they looked broken | |
| 437 | + * rather than gated. Marking them is what makes that honest. | |
| 438 | + * | |
| 439 | + * `pro_only` is the whole mechanism: locked_option_keys() turns | |
| 440 | + * it into the `pro_options` stamp the React admin renders as a | |
| 441 | + * disabled, badged row, and strip_pro_keys() refuses to persist | |
| 442 | + * the value even if a crafted request sends it. | |
| 443 | + */ | |
| 444 | + 'set2' => array( | |
| 445 | + 'text' => esc_html__('Glacier Drift', 'darkify'), | |
| 446 | + 'swatch' => '#123d52', | |
| 447 | + 'pro_only' => true, | |
| 448 | + ), | |
| 449 | + 'set4' => array( | |
| 450 | + 'text' => esc_html__('Indigo Veil', 'darkify'), | |
| 451 | + 'swatch' => '#46598c', | |
| 452 | + 'pro_only' => true, | |
| 453 | + ), | |
| 454 | + 'set5' => array( | |
| 455 | + 'text' => esc_html__('Duskmire', 'darkify'), | |
| 456 | + 'swatch' => '#403953', | |
| 457 | + 'pro_only' => true, | |
| 458 | + ), | |
| 459 | + 'set7' => array( | |
| 460 | + 'text' => esc_html__('Tidal Frost', 'darkify'), | |
| 461 | + 'swatch' => '#286f8d', | |
| 462 | + 'pro_only' => true, | |
| 463 | + ), | |
| 464 | + 'set8' => array( | |
| 465 | + 'text' => esc_html__('Blue Bastion', 'darkify'), | |
| 466 | + 'swatch' => '#244892', | |
| 467 | + 'pro_only' => true, | |
| 468 | + ), | |
| 469 | + 'set11' => array( | |
| 470 | + 'text' => esc_html__('Crimson Veil', 'darkify'), | |
| 471 | + 'swatch' => '#440649', | |
| 472 | + 'pro_only' => true, | |
| 473 | + ), | |
| 474 | + ), | |
| 475 | + 'dependency' => array('block_editor_dark_mode', '==', 'true'), | |
| 476 | + ), | |
| 477 | + | |
| 280 | 478 | array( |
| 281 | 479 | 'id' => 'classic_editor_dark_mode', |
| 282 | 480 | 'type' => 'switcher', |
| 283 | 481 | 'title' => esc_html__('Classic Editor Dark Mode', 'darkify'), |