wpcom-editor-colors.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <?php
  2. /*
  3. * Custom Editor Colors: Varia
  4. */
  5. // Background Color (White)
  6. // $config-global--color-background-default
  7. add_editor_color_rule( 'bg', '#ffffff', array(
  8. // Background-color
  9. array( '#editor .editor-styles-wrapper,
  10. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link,
  11. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link.has-focus,
  12. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link:focus,
  13. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link:hover', 'background-color' ),
  14. // Text-color
  15. array( '#editor .editor-styles-wrapper .button,
  16. #editor .editor-styles-wrapper .button.has-focus,
  17. #editor .editor-styles-wrapper .button:focus,
  18. #editor .editor-styles-wrapper .button:hover,
  19. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button,
  20. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button:focus,
  21. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button:hover,
  22. #editor .editor-styles-wrapper .fse-template-part .main-navigation .has-focus.button,
  23. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button,
  24. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:focus,
  25. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:hover,
  26. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .has-focus.button,
  27. #editor .editor-styles-wrapper .wp-block-button__link,
  28. #editor .editor-styles-wrapper .wp-block-button__link.has-focus,
  29. #editor .editor-styles-wrapper .wp-block-button__link:focus,
  30. #editor .editor-styles-wrapper .wp-block-button__link:hover,
  31. #editor .editor-styles-wrapper table.is-style-stripes tbody tr:nth-child(odd),
  32. #editor .editor-styles-wrapper .wp-block-table.is-style-stripes tbody tr:nth-child(odd),
  33. #editor .editor-styles-wrapper .wp-block-search .wp-block-search__button,
  34. #editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color', 'color' ),
  35. // Background-color
  36. array( '#editor .editor-styles-wrapper .wp-block-button__link.has-focus,
  37. #editor .editor-styles-wrapper .wp-block-button__link:focus,
  38. #editor .editor-styles-wrapper .wp-block-button__link:hover', 'color', 0.8 ),
  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. ), __( 'Background Color' ) );
  60. // Link Color (Blue)
  61. // $config-global--color-primary-default
  62. add_editor_color_rule( 'link', '#0000ff', array(
  63. // Background-color
  64. array( '#editor .editor-styles-wrapper .button,
  65. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button,
  66. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button,
  67. #editor .editor-styles-wrapper .wp-block-search .wp-block-search__button,
  68. #editor .editor-styles-wrapper .wp-block-button__link,
  69. #editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color', 'background-color' ),
  70. // Text-color
  71. array( '#editor .editor-styles-wrapper .fse-template-part .main-navigation a,
  72. #editor .editor-styles-wrapper .fse-template-part .main-navigation a:link,
  73. #editor .editor-styles-wrapper .fse-template-part .main-navigation a:visited,
  74. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link,
  75. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a,
  76. #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline,
  77. #editor .editor-styles-wrapper a', 'color' ),
  78. // Border color left
  79. array( '#editor .editor-styles-wrapper .wp-block-quote', 'border-left-color' ),
  80. // Border color right
  81. array( '#editor .editor-styles-wrapper .wp-block-quote[style*="text-align: right"],
  82. #editor .editor-styles-wrapper .wp-block-quote[style*="text-align:right"]', 'border-right-color' ),
  83. // Background-color
  84. array( '#editor .editor-styles-wrapper .button.has-focus,
  85. #editor .editor-styles-wrapper .button:focus,
  86. #editor .editor-styles-wrapper .button:hover,
  87. #editor .editor-styles-wrapper .fse-template-part .main-navigation #toggle:focus + #toggle-menu,
  88. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button:focus,
  89. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button:hover,
  90. #editor .editor-styles-wrapper .fse-template-part .main-navigation .has-focus.button,
  91. #editor .editor-styles-wrapper .wp-block-search .wp-block-search__button:focus,
  92. #editor .editor-styles-wrapper .wp-block-search .wp-block-search__button:hover,
  93. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:focus,
  94. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:hover,
  95. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .has-focus.button,
  96. #editor .editor-styles-wrapper .wp-block-button__link.has-focus,
  97. #editor .editor-styles-wrapper .wp-block-button__link:focus,
  98. #editor .editor-styles-wrapper .wp-block-button__link:hover', 'background-color', 0.8 ),
  99. // Border-color (forms)
  100. // Needs contrast against `bg` with less contrast
  101. array( '#editor .editor-styles-wrapper .wp-block-search .wp-block-search__input:focus,
  102. textarea:focus', 'border-color' ),
  103. // Text-color
  104. array( '#editor .editor-styles-wrapper .fse-template-part .main-navigation a:hover,
  105. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link.has-focus,
  106. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link:focus,
  107. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link:hover,
  108. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .cat-links a:active,
  109. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .cat-links a:hover,
  110. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-meta a:active,
  111. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-meta a:hover,
  112. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a:hover,
  113. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .more-link:active,
  114. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .more-link:hover,
  115. #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline.has-focus,
  116. #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline:focus,
  117. #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline:hover,
  118. #editor .editor-styles-wrapper a:hover', 'color', 0.8 ),
  119. /**
  120. * Utility Classes
  121. */
  122. // Background-color
  123. array( '#editor .editor-styles-wrapper .has-primary-background-color[class]', 'background-color' ),
  124. // Text-color
  125. array( '#editor .editor-styles-wrapper .has-primary-color[class]', 'color' ),
  126. ), __( 'Link Color' ) );
  127. // Text Color (Gray)
  128. // $config-global--color-foreground-default
  129. add_editor_color_rule( 'txt', '#444444', array(
  130. // Text-color
  131. array( '#editor .editor-post-title__block .editor-post-title__input,
  132. #editor .editor-styles-wrapper .fse-template-part .main-navigation,
  133. #editor .editor-styles-wrapper,
  134. #editor .editor-styles-wrapper .wp-block-pullquote,
  135. #editor .editor-styles-wrapper hr.wp-block-separator.is-style-dots:before', 'color' ),
  136. // Text-color with less opacity (dim)
  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-search .wp-block-search__input,
  147. #editor .editor-styles-wrapper .wp-block-search .wp-block-search__input:focus,
  148. #editor .editor-styles-wrapper .wp-block-quote .wp-block-quote__citation,
  149. #editor .editor-styles-wrapper .wp-block-quote cite,
  150. #editor .editor-styles-wrapper .wp-block-quote footer,
  151. #editor .editor-styles-wrapper .wp-block-quote.is-large .wp-block-quote__citation,
  152. #editor .editor-styles-wrapper .wp-block-quote.is-large cite,
  153. #editor .editor-styles-wrapper .wp-block-quote.is-large footer,
  154. #editor .editor-styles-wrapper .wp-block-quote.is-style-large .wp-block-quote__citation,
  155. #editor .editor-styles-wrapper .wp-block-quote.is-style-large cite,
  156. #editor .editor-styles-wrapper .wp-block-quote.is-style-large footer,
  157. #editor .editor-styles-wrapper .wp-block-video figcaption,
  158. #editor .editor-styles-wrapper figcaption', 'color', 0.8 ),
  159. // Border-color with less opacity (dim)
  160. array( '#editor .editor-styles-wrapper .wp-block-code,
  161. #editor .editor-styles-wrapper .wp-block-search .wp-block-search__input', 'border-color', 0.8 ),
  162. // Border-top-color with less opacity (dim)
  163. array( '#editor .editor-styles-wrapper .wp-block-pullquote', 'border-top-color', 0.8 ),
  164. // Border-bottom-color with less opacity (dim)
  165. array( '#editor .editor-styles-wrapper .wp-block-pullquote,
  166. #editor .editor-styles-wrapper .wp-block-separator', 'border-bottom-color', 0.8 ),
  167. // Background-color
  168. array( '#editor .editor-styles-wrapper table.is-style-stripes tbody tr:nth-child(odd),
  169. #editor .editor-styles-wrapper .wp-block-table.is-style-stripes tbody tr:nth-child(odd)', 'background-color' ),
  170. /**
  171. * Utility Classes
  172. */
  173. // Text-color
  174. array( '#editor .editor-styles-wrapper .has-background-background-color[class],
  175. #editor .editor-styles-wrapper .has-background-dark-background-color[class],
  176. #editor .editor-styles-wrapper .has-background-light-background-color[class],
  177. #editor .editor-styles-wrapper .has-foreground-color[class]', 'color' ),
  178. // Background-color
  179. array( '#editor .editor-styles-wrapper .has-foreground-background-color[class]', 'background-color' ),
  180. // Text-color darkened
  181. array( '#editor .editor-styles-wrapper .has-foreground-dark-color[class]', 'color', '-1' ),
  182. // Background-color darkened
  183. array( '#editor .editor-styles-wrapper .has-foreground-dark-background-color[class]', 'background-color', '-1' ),
  184. // Text-color brightened
  185. array( '#editor .editor-styles-wrapper .has-foreground-light-color[class]', 'color', '+2' ),
  186. // Background-color brightened
  187. array( '#editor .editor-styles-wrapper .has-foreground-light-background-color[class]', 'background-color', '+2' ),
  188. ), __( 'Text Color' ) );
  189. // Accent Color (Red)
  190. // $config-global--color-secondary-default
  191. add_editor_color_rule( 'fg1', '#ff0000', array(
  192. /**
  193. * Utility Classes
  194. */
  195. // Text-color
  196. array( '#editor .editor-styles-wrapper .has-secondary-color[class]', 'color' ),
  197. // Background-color
  198. array( '#editor .editor-styles-wrapper .has-secondary-background-color[class]', 'background-color' ),
  199. ), __( 'Secondary Color' ) );