wpcom-colors.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. require_once __DIR__ . '/wpcom-colors-utils.php';
  3. seedlet_define_color_annotations(
  4. array(
  5. 'background' => '#FFFFFF',
  6. 'foreground' => '#000000',
  7. 'primary' => '#DB0042',
  8. 'secondary' => '#555555',
  9. 'tertiary' => '#FAFBF6',
  10. )
  11. );
  12. /**
  13. * Add a customizer message about dark mode.
  14. */
  15. if ( ! function_exists( 'spearhead_wpcom_customize_update' ) ) :
  16. function spearhead_wpcom_customize_update( $wp_customize ) {
  17. $wpcom_colors_array = get_theme_mod( 'colors_manager' );
  18. $default_palette = array(
  19. 'bg' => '#ffffff',
  20. 'txt' => '#000000',
  21. 'link' => '#db0042',
  22. 'fg1' => '#555555',
  23. 'fg2' => '#fafbf6',
  24. );
  25. if ( $default_palette === $wpcom_colors_array['colors'] ) :
  26. $wp_customize->add_setting( 'color_darkmode_notice' );
  27. $wp_customize->add_control(
  28. 'color_darkmode_notice',
  29. array(
  30. 'id' => 'darkmode_notice',
  31. 'label' => esc_html__( 'Dark Mode', 'spearhead' ),
  32. 'description' => sprintf(
  33. /* translators: %s: link to how to support system display modes */
  34. __( "This theme's default palette will display a dark color palette automatically for users who have dark mode enabled on their devices. <a href='%s' target='_blank'>Learn more about dark mode</a>.", 'spearhead' ),
  35. esc_url( 'https://www.a11yproject.com/posts/2020-01-23-operating-system-and-browser-accessibility-display-modes/' )
  36. ),
  37. 'section' => 'colors_manager_tool',
  38. 'priority' => 10, // Set to 10 so it appears near the top of the Colors & Backgrounds panel
  39. 'type' => 'hidden',
  40. )
  41. );
  42. endif;
  43. }
  44. add_action( 'customize_register', 'spearhead_wpcom_customize_update' );
  45. endif;