wpcom-editor-colors.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <?php
  2. /* Custom Colors: Varia */
  3. // Background Color (White)
  4. // $config-global--color-background-default
  5. add_color_rule( 'bg', '#ffffff', array(
  6. // Background-color
  7. array( '#editor .editor-styles-wrapper,
  8. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link,
  9. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link.has-focus,
  10. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link:focus,
  11. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link:hover', 'background-color' ),
  12. // Text-color
  13. // Needs contrast against `link` (primary)
  14. array( '#editor .editor-styles-wrapper .button,
  15. #editor .editor-styles-wrapper .button.has-focus,
  16. #editor .editor-styles-wrapper .button:focus,
  17. #editor .editor-styles-wrapper .button:hover,
  18. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button,
  19. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button:focus,
  20. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button:hover,
  21. #editor .editor-styles-wrapper .fse-template-part .main-navigation .has-focus.button,
  22. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button,
  23. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:focus,
  24. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:hover,
  25. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .has-focus.button,
  26. #editor .editor-styles-wrapper .wp-block-button__link,
  27. #editor .editor-styles-wrapper .wp-block-button__link.has-focus,
  28. #editor .editor-styles-wrapper .wp-block-button__link:focus,
  29. #editor .editor-styles-wrapper .wp-block-button__link:hover,
  30. #editor .editor-styles-wrapper .wp-block-cover,
  31. #editor .editor-styles-wrapper .wp-block-cover-image,
  32. #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .block-editor-block-list__block,
  33. #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-image-text,
  34. #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-text,
  35. #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover__inner-container,
  36. #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .block-editor-block-list__block,
  37. #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover-image-text,
  38. #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover-text,
  39. #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover__inner-container,
  40. #editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color', 'color', 'link' ),
  41. // Background-color
  42. array( '#editor .editor-styles-wrapper .wp-block-button__link.has-focus,
  43. #editor .editor-styles-wrapper .wp-block-button__link:focus,
  44. #editor .editor-styles-wrapper .wp-block-button__link:hover', 'color', 'link', 16 ),
  45. /**
  46. * Utility Classes
  47. */
  48. // Text-color
  49. // Needs contrast against `link` (primary)
  50. array( '#editor .editor-styles-wrapper .has-primary-background-color[class]', 'color', 'link' ),
  51. // Text-color
  52. // Needs contrast against `fg1` (secondary)
  53. array( '#editor .editor-styles-wrapper .has-secondary-background-color[class]', 'color', 'fg1' ),
  54. // Text-color
  55. // Needs contrast against `txt` (foreground)
  56. array( '#editor .editor-styles-wrapper .has-foreground-background-color[class],
  57. #editor .editor-styles-wrapper .has-foreground-dark-background-color[class],
  58. #editor .editor-styles-wrapper .has-foreground-light-background-color[class]', 'color', 'txt', 12 ),
  59. // Text-color
  60. // Needs contrast against `txt` (background)
  61. array( '#editor .editor-styles-wrapper .has-background-color[class],
  62. #editor .editor-styles-wrapper .has-background-dark-color[class],
  63. #editor .editor-styles-wrapper .has-background-light-color[class],
  64. #editor .editor-styles-wrapper .has-background-background-color[class],
  65. #editor .editor-styles-wrapper .has-background-dark-background-color[class],
  66. #editor .editor-styles-wrapper .has-background-light-background-color[class]', 'color', 'bg', 12 ),
  67. // Background-color
  68. array( '#editor .editor-styles-wrapper .has-background-background-color[class]', 'background-color' ),
  69. // Background-color darkened
  70. array( '#editor .editor-styles-wrapper .has-background-dark-background-color[class]', 'background-color', '-1' ),
  71. // Background-color lightened
  72. array( '#editor .editor-styles-wrapper .has-background-light-background-color[class]', 'background-color', '+1' ),
  73. ), __( 'Background Color' ) );
  74. // Link Color (Blue)
  75. // $config-global--color-primary-default
  76. add_color_rule( 'link', '#0000ff', array(
  77. // Background-color
  78. array( '#editor .editor-styles-wrapper .button,
  79. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button,
  80. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button,
  81. #editor .editor-styles-wrapper .wp-block-button__link,
  82. #editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color', 'background-color' ),
  83. // Text-color
  84. // Needs contrast against `bg`
  85. array( '#editor .editor-styles-wrapper .fse-template-part .main-navigation a,
  86. #editor .editor-styles-wrapper .fse-template-part .main-navigation a:link,
  87. #editor .editor-styles-wrapper .fse-template-part .main-navigation a:visited,
  88. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link,
  89. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a,
  90. #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline,
  91. #editor .editor-styles-wrapper a', 'color', 'bg' ),
  92. // Border color left
  93. // Needs contrast against `bg`
  94. array( '#editor .editor-styles-wrapper .wp-block-quote', 'border-left-color', 'bg' ),
  95. // Border color right
  96. // Needs contrast against `bg`
  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', 'bg' ),
  99. // Background-color
  100. // Needs contrast against `bg` with less contrast
  101. array( '#editor .editor-styles-wrapper .button.has-focus,
  102. #editor .editor-styles-wrapper .button:focus,
  103. #editor .editor-styles-wrapper .button:hover,
  104. #editor .editor-styles-wrapper .fse-template-part .main-navigation #toggle:focus + #toggle-menu,
  105. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button:focus,
  106. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button:hover,
  107. #editor .editor-styles-wrapper .fse-template-part .main-navigation .has-focus.button,
  108. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:focus,
  109. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:hover,
  110. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .has-focus.button,
  111. #editor .editor-styles-wrapper .wp-block-button__link.has-focus,
  112. #editor .editor-styles-wrapper .wp-block-button__link:focus,
  113. #editor .editor-styles-wrapper .wp-block-button__link:hover', 'background-color', 'bg', 3 ),
  114. // Text-color
  115. // Needs contrast against `bg` with less contrast
  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', 'bg', 3 ),
  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. // Needs contrast against `bg`
  138. array( '#editor .editor-styles-wrapper .has-primary-color[class]', 'color', 'bg' ),
  139. ), __( 'Link Color' ) );
  140. // Text Color (Gray)
  141. // $config-global--color-foreground-default
  142. add_color_rule( 'txt', '#444444', array(
  143. // Background-color
  144. // array( '', 'background-color' ),
  145. // Text-color
  146. // Needs contrast against `bg` with more contrast
  147. array( '#editor .editor-post-title__block .editor-post-title__input,
  148. #editor .editor-styles-wrapper .fse-template-part .main-navigation,
  149. #editor .editor-styles-wrapper .wp-block-pullquote,
  150. #editor .editor-styles-wrapper', 'color', 'bg', 7 ),
  151. // Text-color
  152. // Needs contrast against `bg` with less contrast (dim)
  153. array( '#editor .editor-styles-wrapper .a8c-posts-list__item .a8c-posts-list-item__meta,
  154. #editor .editor-styles-wrapper .wp-block-image figcaption,
  155. #editor .editor-styles-wrapper .wp-block-latest-comments .wp-block-latest-comments__comment-date,
  156. #editor .editor-styles-wrapper .wp-block-latest-posts .wp-block-latest-posts__post-date,
  157. #editor .editor-styles-wrapper .wp-block-newspack-blocks-homepage-articles article .cat-links,
  158. #editor .editor-styles-wrapper .wp-block-newspack-blocks-homepage-articles article .entry-meta,
  159. #editor .editor-styles-wrapper .wp-block-pullquote .wp-block-pullquote__citation,
  160. #editor .editor-styles-wrapper .wp-block-pullquote cite,
  161. #editor .editor-styles-wrapper .wp-block-pullquote footer,
  162. #editor .editor-styles-wrapper .wp-block-quote .wp-block-quote__citation,
  163. #editor .editor-styles-wrapper .wp-block-quote cite,
  164. #editor .editor-styles-wrapper .wp-block-quote footer,
  165. #editor .editor-styles-wrapper .wp-block-quote.is-large .wp-block-quote__citation,
  166. #editor .editor-styles-wrapper .wp-block-quote.is-large cite,
  167. #editor .editor-styles-wrapper .wp-block-quote.is-large footer,
  168. #editor .editor-styles-wrapper .wp-block-quote.is-style-large .wp-block-quote__citation,
  169. #editor .editor-styles-wrapper .wp-block-quote.is-style-large cite,
  170. #editor .editor-styles-wrapper .wp-block-quote.is-style-large footer,
  171. #editor .editor-styles-wrapper .wp-block-video figcaption,
  172. #editor .editor-styles-wrapper figcaption', 'color', 'bg', 4 ),
  173. // Border-color
  174. // Needs contrast against `bg` with more contrast
  175. array( '#editor .editor-styles-wrapper .wp-block-code', 'border-color', 'bg', 7 ),
  176. // Border-top-color
  177. // Needs contrast against `bg` with more contrast
  178. array( '#editor .editor-styles-wrapper .wp-block-pullquote', 'border-top-color', 'bg', 7 ),
  179. // Border-bottom-color
  180. // Needs contrast against `bg` with more contrast
  181. array( '#editor .editor-styles-wrapper .wp-block-pullquote,
  182. #editor .editor-styles-wrapper .wp-block-separator', 'border-bottom-color', 'bg', 7 ),
  183. // Text-color
  184. // Needs contrast against `bg` with more contrast
  185. array( '#editor .editor-styles-wrapper hr.wp-block-separator.is-style-dots:before', 'color', 'bg', 7 ),
  186. // Background-color
  187. // Needs contrast against `bg` with more contrast
  188. // array( '', 'background-color', 'bg', 7 ),
  189. /**
  190. * Utility Classes
  191. */
  192. // Foreground
  193. // Needs contrast against `bg`
  194. array( '#editor .editor-styles-wrapper .has-foreground-color[class]', 'color', 'bg' ),
  195. array( '#editor .editor-styles-wrapper .has-background-background-color[class],
  196. #editor .editor-styles-wrapper .has-background-dark-background-color[class],
  197. #editor .editor-styles-wrapper .has-background-light-background-color[class],
  198. #editor .editor-styles-wrapper .has-foreground-background-color[class]', 'background-color' ),
  199. // Text-color darkened
  200. array( '#editor .editor-styles-wrapper .has-foreground-dark-color[class]', 'color', '-1' ),
  201. // Background-color darkened
  202. array( '#editor .editor-styles-wrapper .has-foreground-dark-background-color[class]', 'background-color', '-1' ),
  203. // Text-color brightened
  204. array( '#editor .editor-styles-wrapper .has-foreground-light-color[class]', 'color', '+2' ),
  205. // Background-color brightened
  206. array( '#editor .editor-styles-wrapper .has-foreground-light-background-color[class]', 'background-color', '+2' ),
  207. ), __( 'Text Color' ) );
  208. // Accent Color (Red)
  209. // $config-global--color-secondary-default
  210. add_color_rule( 'fg1', '#ff0000', array(
  211. /**
  212. * Utility Classes
  213. */
  214. // Text-color
  215. // Needs contrast against `bg`
  216. array( '#editor .editor-styles-wrapper .has-secondary-color[class]', 'color', 'bg' ),
  217. // Background-color
  218. array( '#editor .editor-styles-wrapper .has-secondary-background-color[class]', 'background-color' ),
  219. ), __( 'Secondary Color' ) );