wpcom-editor-colors.php 13 KB

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