wpcom-editor-colors.php 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?php
  2. /*
  3. * Custom Editor Colors: Balasana
  4. */
  5. // Background Color (White)
  6. // $config-global--color-background-default
  7. add_editor_color_rule( 'bg', '#FFFFFF', array(
  8. // Text-color
  9. array( '#editor .editor-styles-wrapper .button,
  10. #editor .editor-styles-wrapper .button.has-focus,
  11. #editor .editor-styles-wrapper .button:focus,
  12. #editor .editor-styles-wrapper .button:hover,
  13. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button,
  14. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:focus,
  15. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:hover,
  16. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .has-focus.button,
  17. #editor .editor-styles-wrapper .wp-block-button__link,
  18. #editor .editor-styles-wrapper .wp-block-button__link.has-focus,
  19. #editor .editor-styles-wrapper .wp-block-button__link:focus,
  20. #editor .editor-styles-wrapper .wp-block-button__link:hover,
  21. #editor .editor-styles-wrapper .wp-block-cover.has-background-dim,
  22. #editor .editor-styles-wrapper .wp-block-cover.has-background-dim .block-editor-block-list__block,
  23. #editor .editor-styles-wrapper .wp-block-cover.has-background-dim .wp-block-cover-image-text,
  24. #editor .editor-styles-wrapper .wp-block-cover.has-background-dim .wp-block-cover-text,
  25. #editor .editor-styles-wrapper .wp-block-cover.has-background-dim .wp-block-cover__inner-container,
  26. #editor .editor-styles-wrapper .wp-block-cover-image.has-background-dim,
  27. #editor .editor-styles-wrapper .wp-block-cover-image.has-background-dim .block-editor-block-list__block,
  28. #editor .editor-styles-wrapper .wp-block-cover-image.has-background-dim .wp-block-cover-image-text,
  29. #editor .editor-styles-wrapper .wp-block-cover-image.has-background-dim .wp-block-cover-text,
  30. #editor .editor-styles-wrapper .wp-block-cover-image.has-background-dim .wp-block-cover__inner-container,
  31. #editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color', 'color' ),
  32. // Background-color
  33. array( '#editor .editor-styles-wrapper', 'background-color' ),
  34. /**
  35. * Utility Classes
  36. */
  37. // Text-color
  38. array( '#editor .editor-styles-wrapper .has-primary-background-color,
  39. #editor .editor-styles-wrapper .wp-block .has-primary-background-color,
  40. #editor .editor-styles-wrapper .has-secondary-background-color,
  41. #editor .editor-styles-wrapper .wp-block .has-secondary-background-color,
  42. #editor .editor-styles-wrapper .has-foreground-background-color,
  43. #editor .editor-styles-wrapper .wp-block .has-foreground-background-color,
  44. #editor .editor-styles-wrapper .has-foreground-dark-background-color,
  45. #editor .editor-styles-wrapper .wp-block .has-foreground-dark-background-color,
  46. #editor .editor-styles-wrapper .has-foreground-light-background-color,
  47. #editor .editor-styles-wrapper .wp-block .has-foreground-light-background-color,
  48. #editor .editor-styles-wrapper .has-background-color,
  49. #editor .editor-styles-wrapper .wp-block .has-background-color', 'color' ),
  50. // Background-color
  51. array( '#editor .editor-styles-wrapper .has-background-background-color,
  52. #editor .editor-styles-wrapper .wp-block .has-background-background-color', 'background-color' ),
  53. // Text-color darkened
  54. array( '#editor .editor-styles-wrapper .has-background-dark-color,
  55. #editor .editor-styles-wrapper .wp-block .has-background-dark-color', 'color', '-1' ),
  56. // Background-color darkened
  57. array( '#editor .editor-styles-wrapper .has-background-dark-background-color,
  58. #editor .editor-styles-wrapper .wp-block .has-background-dark-background-color', 'background-color', '-1' ),
  59. // Text-color lightened
  60. array( '#editor .editor-styles-wrapper .has-background-light-color,
  61. #editor .editor-styles-wrapper .wp-block .has-background-light-color', 'color', '+1' ),
  62. // Background-color lightened
  63. array( '#editor .editor-styles-wrapper .has-background-light-background-color,
  64. #editor .editor-styles-wrapper .wp-block .has-background-light-background-color', 'background-color', '+1' ),
  65. ), __( 'Background Color' ) );
  66. // Link Color (Blue)
  67. // $config-global--color-primary-default
  68. add_editor_color_rule( 'link', '#19744C', array(
  69. // Text-color
  70. array( '#editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a,
  71. #editor .editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color),
  72. #editor .editor-styles-wrapper a', 'color' ),
  73. // Background-color
  74. array( '#editor .editor-styles-wrapper .button,
  75. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button,
  76. #editor .editor-styles-wrapper .wp-block-button:not(.is-style-outline) .wp-block-button__link,
  77. #editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color', 'background-color' ),
  78. // Border-left-color
  79. array( '#editor .editor-styles-wrapper .wp-block-quote', 'border-left-color' ),
  80. /**
  81. * Utility Classes
  82. */
  83. // Background-color
  84. array( '#editor .editor-styles-wrapper .has-primary-background-color,
  85. #editor .editor-styles-wrapper .wp-block .has-primary-background-color', 'background-color' ),
  86. // Text-color
  87. array( '#editor .editor-styles-wrapper .has-primary-color', 'color' ),
  88. ), __( 'Link Color' ) );
  89. // Text Color (Gray)
  90. // $config-global--color-foreground-default
  91. add_editor_color_rule( 'txt', '#303030', array(
  92. // Text-color
  93. array( '#editor .editor-styles-wrapper .editor-post-title__block .editor-post-title__input,
  94. #editor .editor-styles-wrapper .wp-block-pullquote,
  95. #editor .editor-styles-wrapper ', 'color' ),
  96. // Background-color
  97. array( '#editor .editor-styles-wrapper .wp-block-cover-image.has-background-dim,
  98. #editor .editor-styles-wrapper .wp-block-cover.has-background-dim', 'background-color' ),
  99. /**
  100. * Utility Classes
  101. */
  102. // Text-color
  103. array( '#editor .editor-styles-wrapper .has-background-background-color,
  104. #editor .editor-styles-wrapper .wp-block .has-background-background-color,
  105. #editor .editor-styles-wrapper .has-background-dark-background-color,
  106. #editor .editor-styles-wrapper .wp-block .has-background-dark-background-color,
  107. #editor .editor-styles-wrapper .has-background-light-background-color,
  108. #editor .editor-styles-wrapper .wp-block .has-background-light-background-color,
  109. #editor .editor-styles-wrapper .has-foreground-color,
  110. #editor .editor-styles-wrapper .wp-block .has-foreground-color', 'color' ),
  111. // Background-color
  112. array( '#editor .editor-styles-wrapper .has-foreground-background-color,
  113. #editor .editor-styles-wrapper .wp-block .has-foreground-background-color', 'background-color' ),
  114. // Text-color darkened
  115. array( '#editor .editor-styles-wrapper .has-foreground-dark-color,
  116. #editor .editor-styles-wrapper .wp-block .has-foreground-dark-color', 'color', '-1' ),
  117. // Background-color darkened
  118. array( '#editor .editor-styles-wrapper .has-foreground-dark-background-color,
  119. #editor .editor-styles-wrapper .wp-block .has-foreground-dark-background-color', 'background-color', '-1' ),
  120. // Text-color brightened
  121. array( '#editor .editor-styles-wrapper .has-foreground-light-color,
  122. #editor .editor-styles-wrapper .wp-block .has-foreground-light-color', 'color', '+2' ),
  123. // Background-color brightened
  124. array( '#editor .editor-styles-wrapper .has-foreground-light-background-color,
  125. #editor .editor-styles-wrapper .wp-block .has-foreground-light-background-color', 'background-color', '+2' ),
  126. ), __( 'Text Color' ) );
  127. // Accent Color (Red)
  128. // $config-global--color-secondary-default
  129. add_editor_color_rule( 'fg1', '#BC2213', array(
  130. /**
  131. * Utility Classes
  132. */
  133. // Text-color
  134. array( '#editor .editor-styles-wrapper .has-secondary-color,
  135. #editor .editor-styles-wrapper .wp-block .has-secondary-color', 'color' ),
  136. // Background-color
  137. array( '#editor .editor-styles-wrapper .has-secondary-background-color,
  138. #editor .editor-styles-wrapper .wp-block .has-secondary-background-color', 'background-color' ),
  139. ), __( 'Secondary Color' ) );
  140. /**
  141. * Custom CSS
  142. */
  143. function balasana_custom_colors_extra_css() { ?>
  144. /* Ensure links match the front end when there's a custom background color. */
  145. #editor .editor-styles-wrapper .wp-block .has-background:not(.has-background-background-color) a {
  146. color: currentColor;
  147. }
  148. <?php }
  149. add_theme_support( 'custom_colors_extra_css', 'balasana_custom_colors_extra_css' );