wpcom-editor-colors.php 12 KB

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