wpcom-editor-colors.php 13 KB

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