wpcom-editor-colors.php 8.8 KB

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