wpcom-editor-colors.php 11 KB

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