wpcom-editor-colors.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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 ', 'background-color' ),
  8. // Text-color
  9. // Needs contrast against `link` (primary)
  10. array( '#editor .editor-styles-wrapper .a8c-posts-list-item__featured span,
  11. #editor .editor-styles-wrapper .a8c-posts-list__view-all,
  12. #editor .editor-styles-wrapper .a8c-posts-list__view-all:focus,
  13. #editor .editor-styles-wrapper .a8c-posts-list__view-all:hover,
  14. #editor .editor-styles-wrapper .button,
  15. #editor .editor-styles-wrapper .button:focus,
  16. #editor .editor-styles-wrapper .button:hover,
  17. #editor .editor-styles-wrapper .has-focus.a8c-posts-list__view-all,
  18. #editor .editor-styles-wrapper .has-focus.button,
  19. #editor .editor-styles-wrapper .has-focus.wp-block-button__link,
  20. #editor .editor-styles-wrapper .has-focus.wp-block-file__button,
  21. #editor .editor-styles-wrapper .wp-block-button__link,
  22. #editor .editor-styles-wrapper .wp-block-button__link:focus,
  23. #editor .editor-styles-wrapper .wp-block-button__link:hover,
  24. #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-image-text,
  25. #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-text,
  26. #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover__inner-container,
  27. #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover-image-text,
  28. #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover-text,
  29. #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover__inner-container,
  30. #editor .editor-styles-wrapper .wp-block-file .wp-block-file__button,
  31. #editor .editor-styles-wrapper .wp-block-file a.wp-block-file__button:active,
  32. #editor .editor-styles-wrapper .wp-block-file a.wp-block-file__button:focus,
  33. #editor .editor-styles-wrapper .wp-block-file a.wp-block-file__button:hover,
  34. #editor .editor-styles-wrapper .wp-block-file a.wp-block-file__button:visited,
  35. #editor .editor-styles-wrapper .wp-block-file__button,
  36. #editor .editor-styles-wrapper .wp-block-file__button:focus,
  37. #editor .editor-styles-wrapper .wp-block-file__button:hover,
  38. #editor .editor-styles-wrapper .wp-block-gallery .blocks-gallery-image figcaption,
  39. #editor .editor-styles-wrapper .wp-block-gallery .blocks-gallery-item figcaption,
  40. #editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color', 'color', 'link' ),
  41. /**
  42. * Utility Classes
  43. */
  44. // Text-color
  45. // Needs contrast against `link` (primary)
  46. array( '#editor .editor-styles-wrapper .has-primary-background-color[class]', 'color', 'link' ),
  47. // Text-color
  48. // Needs contrast against `fg1` (secondary)
  49. array( '#editor .editor-styles-wrapper .has-secondary-background-color[class]', 'color', 'fg1' ),
  50. // Text-color
  51. // Needs contrast against `txt` (foreground)
  52. array( '#editor .editor-styles-wrapper .has-foreground-background-color[class],
  53. #editor .editor-styles-wrapper .has-foreground-dark-background-color[class],
  54. #editor .editor-styles-wrapper .has-foreground-light-background-color[class]', 'color', 'txt', 12 ),
  55. // Text-color
  56. // Needs contrast against `txt` (background)
  57. array( '#editor .editor-styles-wrapper .has-background-color[class],
  58. #editor .editor-styles-wrapper .has-background-dark-color[class],
  59. #editor .editor-styles-wrapper .has-background-light-color[class],
  60. #editor .editor-styles-wrapper .has-background-background-color[class],
  61. #editor .editor-styles-wrapper .has-background-dark-background-color[class],
  62. #editor .editor-styles-wrapper .has-background-light-background-color[class]', 'color', 'bg', 12 ),
  63. // Background-color
  64. array( '#editor .editor-styles-wrapper .has-background-background-color[class]', 'background-color' ),
  65. // Background-color darkened
  66. array( '#editor .editor-styles-wrapper .has-background-dark-background-color[class]', 'background-color', '-1' ),
  67. // Background-color lightened
  68. array( '#editor .editor-styles-wrapper .has-background-light-background-color[class]', 'background-color', '+1' ),
  69. ), __( 'Background Color' ) );
  70. // Link Color (Blue)
  71. // $config-global--color-primary-default
  72. add_color_rule( 'link', '#0000ff', array(
  73. // Background-color
  74. array( '#editor .editor-styles-wrapper .a8c-posts-list-item__featured span,
  75. #editor .editor-styles-wrapper .a8c-posts-list__view-all,
  76. #editor .editor-styles-wrapper .button,
  77. #editor .editor-styles-wrapper .wp-block-button__link,
  78. #editor .editor-styles-wrapper .wp-block-file .wp-block-file__button,
  79. #editor .editor-styles-wrapper .wp-block-file__button,
  80. #editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color', 'background-color' ),
  81. // Text-color
  82. // Needs contrast against `bg`
  83. array( '#editor .editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link,
  84. #editor .editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link:active,
  85. #editor .editor-styles-wrapper .wp-block-button.is-style-outline.wp-block-button__link,
  86. #editor .editor-styles-wrapper .wp-block-button.is-style-outline.wp-block-button__link:active,
  87. #editor .editor-styles-wrapper .wp-block-newspack-blocks-homepage-articles article .entry-title a,
  88. #editor .editor-styles-wrapper a', 'color', 'bg' ),
  89. // Border color left
  90. // Needs contrast against `bg`
  91. array( '#editor .editor-styles-wrapper .wp-block-quote', 'border-left-color', 'bg' ),
  92. // Border color right
  93. // Needs contrast against `bg`
  94. array( '#editor .editor-styles-wrapper .wp-block-quote[style*="text-align: right"],
  95. #editor .editor-styles-wrapper .wp-block-quote[style*="text-align:right"]', 'border-right-color', 'bg' ),
  96. // Background-color
  97. // Needs contrast against `bg` with less contrast
  98. array( '#editor .editor-styles-wrapper .a8c-posts-list__view-all:focus,
  99. #editor .editor-styles-wrapper .a8c-posts-list__view-all:hover,
  100. #editor .editor-styles-wrapper .button:focus,
  101. #editor .editor-styles-wrapper .button:hover,
  102. #editor .editor-styles-wrapper .has-focus.a8c-posts-list__view-all,
  103. #editor .editor-styles-wrapper .has-focus.button,
  104. #editor .editor-styles-wrapper .has-focus.wp-block-button__link,
  105. #editor .editor-styles-wrapper .has-focus.wp-block-file__button,
  106. #editor .editor-styles-wrapper .main-navigation #toggle:focus + #toggle-menu,
  107. #editor .editor-styles-wrapper .wp-block-button__link:focus,
  108. #editor .editor-styles-wrapper .wp-block-button__link:hover,
  109. #editor .editor-styles-wrapper .wp-block-file__button:focus,
  110. #editor .editor-styles-wrapper .wp-block-file__button:hover', 'background-color', 'bg', 3 ),
  111. // Text-color
  112. // Needs contrast against `bg` with less contrast
  113. array( '#editor .editor-styles-wrapper .a8c-posts-list__item .a8c-posts-list-item__meta a:active,
  114. #editor .editor-styles-wrapper .a8c-posts-list__item .a8c-posts-list-item__meta a:hover,
  115. #editor .editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link.has-focus,
  116. #editor .editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link:focus,
  117. #editor .editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link:hover,
  118. #editor .editor-styles-wrapper .wp-block-button.is-style-outline.wp-block-button__link.has-focus,
  119. #editor .editor-styles-wrapper .wp-block-button.is-style-outline.wp-block-button__link:focus,
  120. #editor .editor-styles-wrapper .wp-block-button.is-style-outline.wp-block-button__link:hover,
  121. #editor .editor-styles-wrapper .wp-block-newspack-blocks-homepage-articles article .cat-links a:active,
  122. #editor .editor-styles-wrapper .wp-block-newspack-blocks-homepage-articles article .cat-links a:hover,
  123. #editor .editor-styles-wrapper .wp-block-newspack-blocks-homepage-articles article .entry-meta a:active,
  124. #editor .editor-styles-wrapper .wp-block-newspack-blocks-homepage-articles article .entry-meta a:hover,
  125. #editor .editor-styles-wrapper .wp-block-newspack-blocks-homepage-articles article .entry-title a:hover,
  126. #editor .editor-styles-wrapper a:hover', 'color', 'bg', 3 ),
  127. /**
  128. * Utility Classes
  129. */
  130. // Background-color
  131. array( '#editor .editor-styles-wrapper .has-primary-background-color[class]', 'background-color' ),
  132. // Text-color
  133. // Needs contrast against `bg`
  134. array( '#editor .editor-styles-wrapper .has-primary-color[class]', 'color', 'bg' ),
  135. ), __( 'Link Color' ) );
  136. // Text Color (Gray)
  137. // $config-global--color-foreground-default
  138. add_color_rule( 'txt', '#444444', array(
  139. // Background-color
  140. // array( '', 'background-color' ),
  141. // Text-color
  142. // Needs contrast against `bg` with more contrast
  143. array( '#editor .editor-styles-wrapper .wp-block-code,
  144. #editor .editor-styles-wrapper .wp-block-code pre,
  145. #editor .editor-styles-wrapper .wp-block-pullquote,
  146. #editor .editor-styles-wrapper body', 'color', 'bg', 7 ),
  147. // Text-color
  148. // Needs contrast against `bg` with less contrast (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-quote .wp-block-quote__citation,
  159. #editor .editor-styles-wrapper .wp-block-quote cite,
  160. #editor .editor-styles-wrapper .wp-block-quote footer,
  161. #editor .editor-styles-wrapper .wp-block-quote.is-large .wp-block-quote__citation,
  162. #editor .editor-styles-wrapper .wp-block-quote.is-large cite,
  163. #editor .editor-styles-wrapper .wp-block-quote.is-large footer,
  164. #editor .editor-styles-wrapper .wp-block-quote.is-style-large .wp-block-quote__citation,
  165. #editor .editor-styles-wrapper .wp-block-quote.is-style-large cite,
  166. #editor .editor-styles-wrapper .wp-block-quote.is-style-large footer,
  167. #editor .editor-styles-wrapper .wp-block-video figcaption,
  168. #editor .editor-styles-wrapper figcaption', 'color', 'bg', 4 ),
  169. // Border-color
  170. // Needs contrast against `bg` with more contrast
  171. array( '#editor .editor-styles-wrapper .wp-block-code', 'border-color', 'bg', 7 ),
  172. // Border-top-color
  173. // Needs contrast against `bg` with more contrast
  174. array( '#editor .editor-styles-wrapper .wp-block-pullquote', 'border-top-color', 'bg', 7 ),
  175. // Border-bottom-color
  176. // Needs contrast against `bg` with more contrast
  177. array( '#editor .editor-styles-wrapper .wp-block-pullquote,
  178. #editor .editor-styles-wrapper .wp-block-separator', 'border-bottom-color', 'bg', 7 ),
  179. // Text-color
  180. // Needs contrast against `bg` with more contrast
  181. array( '#editor .editor-styles-wrapper hr.wp-block-separator.is-style-dots:before', 'color', 'bg', 7 ),
  182. // Background-color
  183. // Needs contrast against `bg` with more contrast
  184. // array( '', 'background-color', 'bg', 7 ),
  185. /**
  186. * Utility Classes
  187. */
  188. // Foreground
  189. // Needs contrast against `bg`
  190. array( '#editor .editor-styles-wrapper .has-foreground-color[class]', 'color', 'bg' ),
  191. array( '#editor .editor-styles-wrapper .has-foreground-background-color[class]', 'background-color' ),
  192. // Text-color darkened
  193. array( '#editor .editor-styles-wrapper .has-foreground-dark-color[class]', 'color', '-1' ),
  194. // Background-color darkened
  195. array( '#editor .editor-styles-wrapper .has-foreground-dark-background-color[class]', 'background-color', '-1' ),
  196. // Text-color brightened
  197. array( '#editor .editor-styles-wrapper .has-foreground-light-color[class]', 'color', '+2' ),
  198. // Background-color brightened
  199. array( '#editor .editor-styles-wrapper .has-foreground-light-background-color[class]', 'background-color', '+2' ),
  200. ), __( 'Text Color' ) );
  201. // Accent Color (Red)
  202. // $config-global--color-secondary-default
  203. add_color_rule( 'fg1', '#ff0000', array(
  204. /**
  205. * Utility Classes
  206. */
  207. // Text-color
  208. // Needs contrast against `bg`
  209. array( '#editor .editor-styles-wrapper .has-secondary-color[class]', 'color', 'bg' ),
  210. // Background-color
  211. array( '#editor .editor-styles-wrapper .has-secondary-background-color[class]', 'background-color' ),
  212. ), __( 'Secondary Color' ) );