wpcom-editor-colors.php 12 KB

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