wpcom-editor-colors.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <?php
  2. /*
  3. * Custom Editor Colors
  4. */
  5. // Background Color
  6. // $config-global--color-background-default
  7. add_editor_color_rule( 'bg', '#FFFFFF', array(
  8. // Background-color
  9. array( '#editor .editor-styles-wrapper', 'background-color' ),
  10. // Text-color
  11. array( '#editor .editor-styles-wrapper .button,
  12. #editor .editor-styles-wrapper .button.has-focus,
  13. #editor .editor-styles-wrapper .button:focus,
  14. #editor .editor-styles-wrapper .button:hover,
  15. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button,
  16. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:focus,
  17. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:hover,
  18. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .has-focus.button,
  19. #editor .editor-styles-wrapper .wp-block-button__link,
  20. #editor .editor-styles-wrapper .wp-block-button__link.has-focus,
  21. #editor .editor-styles-wrapper .wp-block-button__link:focus,
  22. #editor .editor-styles-wrapper .wp-block-button__link:hover,
  23. #editor .editor-styles-wrapper table.is-style-stripes tbody tr:nth-child(odd),
  24. #editor .editor-styles-wrapper .wp-block-table.is-style-stripes tbody tr:nth-child(odd),
  25. #editor .editor-styles-wrapper .wp-block-search .wp-block-search__button,
  26. #editor .editor-styles-wrapper .has-background a,
  27. #editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color', 'color' ),
  28. /**
  29. * Utility Classes
  30. */
  31. // Text-color
  32. array( '#editor .editor-styles-wrapper .has-primary-background-color[class],
  33. #editor .editor-styles-wrapper .has-secondary-background-color[class],
  34. #editor .editor-styles-wrapper .has-foreground-background-color[class],
  35. #editor .editor-styles-wrapper .has-foreground-dark-background-color[class],
  36. #editor .editor-styles-wrapper .has-foreground-light-background-color[class],
  37. #editor .editor-styles-wrapper .has-background-color[class]', 'color' ),
  38. // Background-color
  39. array( '#editor .editor-styles-wrapper .has-background-background-color[class]', 'background-color' ),
  40. // Text-color darkened
  41. array( '#editor .editor-styles-wrapper .has-background-dark-color[class]', 'color', '-1' ),
  42. // Background-color darkened
  43. array( '#editor .editor-styles-wrapper .has-background-dark-background-color[class]', 'background-color', '-1' ),
  44. // Text-color lightened
  45. array( '#editor .editor-styles-wrapper .has-background-light-color[class]', 'color', '+1' ),
  46. // Background-color lightened
  47. array( '#editor .editor-styles-wrapper .has-background-light-background-color[class]', 'background-color', '+1' ),
  48. /**
  49. * Grays
  50. * Uses a slightly darker color
  51. */
  52. // Color
  53. array( '#editor .editor-styles-wrapper .wp-block-separator.is-style-dots', 'color', '-1' ),
  54. // Border-color
  55. array( '#editor .editor-styles-wrapper .wp-block-code', 'border-color', '-1' ),
  56. // Border-top-color
  57. array( '#editor .editor-styles-wrapper .wp-block-pullquote', 'border-top-color', '-1' ),
  58. // Border-bottom-color
  59. array( '#editor .editor-styles-wrapper .wp-block-pullquote,
  60. #editor .editor-styles-wrapper .wp-block-separator', 'border-bottom-color', '-1' ),
  61. /**
  62. * Clean up for nested items
  63. */
  64. // Text-color
  65. array( '#editor .editor-styles-wrapper .has-background:not(.has-background-background-color) .wp-block-quote .wp-block-quote__citation,
  66. #editor .editor-styles-wrapper [class*="background-color"]:not(.has-background-background-color) .wp-block-quote .wp-block-quote__citation,
  67. #editor .editor-styles-wrapper [style*="background-color"]:not(.has-background-background-color) .wp-block-quote .wp-block-quote__citation,
  68. #editor .editor-styles-wrapper .wp-block-cover[style*="background-image"] .wp-block-quote .wp-block-quote__citation', 'color' ),
  69. // Border-color
  70. array( '#editor .editor-styles-wrapper .has-background:not(.has-background-background-color) .wp-block-quote,
  71. #editor .editor-styles-wrapper [class*="background-color"]:not(.has-background-background-color) .wp-block-quote,
  72. #editor .editor-styles-wrapper [style*="background-color"]:not(.has-background-background-color) .wp-block-quote,
  73. #editor .editor-styles-wrapper .wp-block-cover[style*="background-image"] .wp-block-quote', 'border-color'),
  74. ), __( 'Background Color' ) );
  75. // Link Color
  76. // $config-global--color-primary-default
  77. add_editor_color_rule( 'link', '#000000', array(
  78. // Background-color
  79. array( '#editor .editor-styles-wrapper .button,
  80. #editor .editor-styles-wrapper .wp-block-search .wp-block-search__button,
  81. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button,
  82. #editor .editor-styles-wrapper .wp-block-button:not(.is-style-outline) .wp-block-button__link:not(.has-background),
  83. #editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color', 'background-color' ),
  84. // Text-color
  85. array( '#editor .editor-styles-wrapper .is-style-outline .wp-block-button__link:not(.has-text-color),
  86. #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline:not(.has-text-color),
  87. #editor .editor-styles-wrapper a', 'color' ),
  88. // Border color left
  89. array( '#editor .editor-styles-wrapper .wp-block-quote', 'border-left-color' ),
  90. // Border color right
  91. array( '#editor .editor-styles-wrapper .wp-block-quote[style*="text-align: right"],
  92. #editor .editor-styles-wrapper .wp-block-quote[style*="text-align:right"]', 'border-right-color' ),
  93. /**
  94. * Utility Classes
  95. */
  96. // Background-color
  97. array( '#editor .editor-styles-wrapper .has-primary-background-color[class]', 'background-color' ),
  98. // Text-color
  99. array( '#editor .editor-styles-wrapper .has-primary-color[class]', 'color' ),
  100. ), __( 'Link Color' ) );
  101. // Text Color
  102. // $config-global--color-foreground-default
  103. add_editor_color_rule( 'txt', '#444444', array(
  104. // Text-color
  105. array( '#editor .editor-styles-wrapper .editor-post-title__block .editor-post-title__input,
  106. #editor .editor-styles-wrapper .wp-block-pullquote,
  107. #editor .editor-styles-wrapper', 'color' ),
  108. // Background-color
  109. array( '#editor .editor-styles-wrapper table.is-style-stripes tbody tr:nth-child(odd),
  110. #editor .editor-styles-wrapper .wp-block-table.is-style-stripes tbody tr:nth-child(odd)', 'background-color' ),
  111. /**
  112. * Utility Classes
  113. */
  114. // Text-color
  115. array( '#editor .editor-styles-wrapper .has-foreground-color[class],
  116. #editor .editor-styles-wrapper .has-background-background-color[class],
  117. #editor .editor-styles-wrapper .has-background-dark-background-color[class],
  118. #editor .editor-styles-wrapper .has-background-light-background-color[class],
  119. #editor .editor-styles-wrapper .has-background-background-color[class] a', 'color' ),
  120. // Background-color
  121. array( '#editor .editor-styles-wrapper .has-foreground-background-color[class]', 'background-color' ),
  122. // Text-color darkened
  123. array( '#editor .editor-styles-wrapper .has-foreground-dark-color[class]', 'color', '-1' ),
  124. // Background-color darkened
  125. array( '#editor .editor-styles-wrapper .has-foreground-dark-background-color[class]', 'background-color', '-1' ),
  126. // Text-color brightened
  127. array( '#editor .editor-styles-wrapper .has-foreground-light-color[class]', 'color', '+2' ),
  128. // Background-color brightened
  129. array( '#editor .editor-styles-wrapper .has-foreground-light-background-color[class]', 'background-color', '+2' ),
  130. /**
  131. * Grays
  132. * Same as text color
  133. */
  134. // Text-color
  135. array( '#editor .editor-styles-wrapper .a8c-posts-list__item .a8c-posts-list-item__meta,
  136. #editor .editor-styles-wrapper .wp-block-image figcaption,
  137. #editor .editor-styles-wrapper .wp-block-latest-comments .wp-block-latest-comments__comment-date,
  138. #editor .editor-styles-wrapper .wp-block-latest-posts .wp-block-latest-posts__post-date,
  139. #editor .editor-styles-wrapper .wp-block-newspack-blocks-homepage-articles article .cat-links,
  140. #editor .editor-styles-wrapper .wp-block-newspack-blocks-homepage-articles article .entry-meta,
  141. #editor .editor-styles-wrapper .wp-block-pullquote .wp-block-pullquote__citation,
  142. #editor .editor-styles-wrapper .wp-block-pullquote cite,
  143. #editor .editor-styles-wrapper .wp-block-pullquote footer,
  144. #editor .editor-styles-wrapper .wp-block-quote .wp-block-quote__citation,
  145. #editor .editor-styles-wrapper .wp-block-quote cite,
  146. #editor .editor-styles-wrapper .wp-block-quote footer,
  147. #editor .editor-styles-wrapper .wp-block-quote.is-large .wp-block-quote__citation,
  148. #editor .editor-styles-wrapper .wp-block-quote.is-large cite,
  149. #editor .editor-styles-wrapper .wp-block-quote.is-large footer,
  150. #editor .editor-styles-wrapper .wp-block-quote.is-style-large .wp-block-quote__citation,
  151. #editor .editor-styles-wrapper .wp-block-quote.is-style-large cite,
  152. #editor .editor-styles-wrapper .wp-block-quote.is-style-large footer,
  153. #editor .editor-styles-wrapper .wp-block-video figcaption,
  154. #editor .editor-styles-wrapper figcaption', 'color' ),
  155. ), __( 'Text Color' ) );
  156. // Accent Color (Red)
  157. // $config-global--color-secondary-default
  158. add_editor_color_rule( 'fg1', '#FF7A5C', array(
  159. // Text-color
  160. array( '#editor .editor-styles-wrapper .is-style-outline .wp-block-button__link.has-focus,
  161. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link:focus,
  162. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link:hover,
  163. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .cat-links a:active,
  164. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .cat-links a:hover,
  165. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-meta a:active,
  166. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-meta a:hover,
  167. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a:hover,
  168. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .more-link:active,
  169. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .more-link:hover,
  170. #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline.has-focus,
  171. #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline:focus,
  172. #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline:hover,
  173. #editor .editor-styles-wrapper a:hover', 'color' ),
  174. // Background-color
  175. array( '#editor .editor-styles-wrapper .button.has-focus,
  176. #editor .editor-styles-wrapper .button:focus,
  177. #editor .editor-styles-wrapper .button:hover,
  178. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:focus,
  179. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:hover,
  180. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .has-focus.button,
  181. #editor .editor-styles-wrapper .wp-block-button__link.has-focus,
  182. #editor .editor-styles-wrapper .wp-block-button__link:focus,
  183. #editor .editor-styles-wrapper .wp-block-button__link:hover', 'background-color' ),
  184. // Text-decoration-color
  185. array( '#editor .editor-styles-wrapper .wp-block-a8c-blog-posts .more-link', 'text-decoration-color' ),
  186. /**
  187. * Utility Classes
  188. */
  189. // Text-color
  190. array( '#editor .editor-styles-wrapper .has-secondary-color[class]', 'color' ),
  191. // Background-color
  192. array( '#editor .editor-styles-wrapper .has-secondary-background-color[class]', 'background-color' ),
  193. ), __( 'Secondary Color' ) );