wpcom-colors.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  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( '.screen-reader-text:focus,
  8. body,
  9. body .widget_eu_cookie_law_widget #eu-cookie-law,
  10. body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept,
  11. .main-navigation > div > ul > li > .sub-menu', 'background-color' ),
  12. // Text-color
  13. // Needs contrast against `link` (primary)
  14. array( '.a8c-posts-list-item__featured span,
  15. .a8c-posts-list__view-all,
  16. .a8c-posts-list__view-all:focus,
  17. .a8c-posts-list__view-all:hover,
  18. .button,
  19. .button:focus,
  20. .button:hover,
  21. .has-focus.a8c-posts-list__view-all,
  22. .has-focus.button,
  23. .has-focus.wp-block-button__link,
  24. .has-focus.wp-block-file__button,
  25. .sticky-post,
  26. .wp-block-button__link,
  27. .wp-block-button__link:focus,
  28. .wp-block-button__link:hover,
  29. .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-image-text,
  30. .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-text,
  31. .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover__inner-container,
  32. .wp-block-cover:not([class*="background-color"]) .wp-block-cover-image-text,
  33. .wp-block-cover:not([class*="background-color"]) .wp-block-cover-text,
  34. .wp-block-cover:not([class*="background-color"]) .wp-block-cover__inner-container,
  35. .wp-block-file .wp-block-file__button,
  36. .wp-block-file a.wp-block-file__button:active,
  37. .wp-block-file a.wp-block-file__button:focus,
  38. .wp-block-file a.wp-block-file__button:hover,
  39. .wp-block-file a.wp-block-file__button:visited,
  40. .wp-block-file__button,
  41. .wp-block-file__button:focus,
  42. .wp-block-file__button:hover,
  43. .wp-block-gallery .blocks-gallery-image figcaption,
  44. .wp-block-gallery .blocks-gallery-item figcaption,
  45. .wp-block-pullquote.is-style-solid-color,
  46. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept,
  47. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:focus,
  48. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:hover,
  49. body .widget_eu_cookie_law_widget #eu-cookie-law input.has-focus.accept,
  50. body .widget_eu_cookie_law_widget #eu-cookie-law.negative,
  51. button,
  52. button.has-focus,
  53. button:focus,
  54. button:hover,
  55. button[data-load-more-btn],
  56. input.has-focus[type="submit"],
  57. input:focus[type="submit"],
  58. input:hover[type="submit"],
  59. input[type="submit"]', 'color', 'link' ),
  60. /**
  61. * Utility Classes
  62. */
  63. // Text-color
  64. // Needs contrast against `link` (primary)
  65. array( '.has-primary-background-color[class]', 'color', 'link' ),
  66. // Text-color
  67. // Needs contrast against `fg1` (secondary)
  68. array( '.has-secondary-background-color[class]', 'color', 'fg1' ),
  69. // Text-color
  70. // Needs contrast against `txt` (foreground)
  71. array( '.has-foreground-background-color[class],
  72. .has-foreground-dark-background-color[class],
  73. .has-foreground-light-background-color[class]', 'color', 'txt', 12 ),
  74. // Text-color
  75. // Needs contrast against `txt` (background)
  76. array( '.has-background-color[class],
  77. .has-background-dark-color[class],
  78. .has-background-light-color[class],
  79. .has-background-background-color[class],
  80. .has-background-dark-background-color[class],
  81. .has-background-light-background-color[class]', 'color', 'bg', 12 ),
  82. // Background-color
  83. array( '.has-background-background-color[class]', 'background-color' ),
  84. // Background-color darkened
  85. array( '.has-background-dark-background-color[class]', 'background-color', '-1' ),
  86. // Background-color lightened
  87. array( '.has-background-light-background-color[class]', 'background-color', '+1' ),
  88. ), __( 'Background Color' ) );
  89. // Link Color (Blue)
  90. // $config-global--color-primary-default
  91. add_color_rule( 'link', '#0000ff', array(
  92. // Background-color
  93. array( '.a8c-posts-list-item__featured span,
  94. .a8c-posts-list__view-all,
  95. .button,
  96. .sticky-post,
  97. .wp-block-button__link,
  98. .wp-block-file .wp-block-file__button,
  99. .wp-block-file__button,
  100. .wp-block-pullquote.is-style-solid-color,
  101. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept,
  102. button,
  103. button[data-load-more-btn],
  104. input[type="submit"]', 'background-color' ),
  105. // Text-color
  106. // Needs contrast against `bg`
  107. array( '.main-navigation a,
  108. .main-navigation a:link,
  109. .main-navigation a:visited,
  110. .site-title,
  111. .social-navigation a,
  112. .wp-block-button.is-style-outline .wp-block-button__link,
  113. .wp-block-button.is-style-outline .wp-block-button__link:active,
  114. .wp-block-button.is-style-outline.wp-block-button__link,
  115. .wp-block-button.is-style-outline.wp-block-button__link:active,
  116. .wp-block-newspack-blocks-homepage-articles article .entry-title a,
  117. a', 'color', 'bg' ),
  118. // Border color left
  119. // Needs contrast against `bg`
  120. array( '.wp-block-quote', 'border-left-color', 'bg' ),
  121. // Border color right
  122. // Needs contrast against `bg`
  123. array( '.wp-block-quote[style*="text-align: right"],
  124. .wp-block-quote[style*="text-align:right"]', 'border-right-color', 'bg' ),
  125. // Background-color
  126. // Needs contrast against `bg` with less contrast
  127. array( '.a8c-posts-list__view-all:focus,
  128. .a8c-posts-list__view-all:hover,
  129. .button:focus,
  130. .button:hover,
  131. .has-focus.a8c-posts-list__view-all,
  132. .has-focus.button,
  133. .has-focus.wp-block-button__link,
  134. .has-focus.wp-block-file__button,
  135. .main-navigation #toggle:focus + #toggle-menu,
  136. .wp-block-button__link:focus,
  137. .wp-block-button__link:hover,
  138. .wp-block-file__button:focus,
  139. .wp-block-file__button:hover,
  140. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:focus,
  141. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:hover,
  142. body .widget_eu_cookie_law_widget #eu-cookie-law input.has-focus.accept,
  143. button.has-focus,
  144. button:focus,
  145. button:hover,
  146. input.has-focus[type="submit"],
  147. input:focus[type="submit"],
  148. input:hover[type="submit"]', 'background-color', 'bg', 3 ),
  149. // Text-color
  150. // Needs contrast against `bg` with less contrast
  151. array( '.a8c-posts-list__item .a8c-posts-list-item__meta a:active,
  152. .a8c-posts-list__item .a8c-posts-list-item__meta a:hover,
  153. .comment-meta .comment-metadata a:active,
  154. .comment-meta .comment-metadata a:hover,
  155. .entry-footer a:active,
  156. .entry-footer a:hover,
  157. .entry-meta a:active,
  158. .entry-meta a:hover,
  159. .footer-navigation .footer-menu a:hover,
  160. .main-navigation a:hover,
  161. .site-info a:hover,
  162. .site-title a:hover,
  163. .social-navigation a:hover,
  164. .wp-block-button.is-style-outline .wp-block-button__link.has-focus,
  165. .wp-block-button.is-style-outline .wp-block-button__link:focus,
  166. .wp-block-button.is-style-outline .wp-block-button__link:hover,
  167. .wp-block-button.is-style-outline.wp-block-button__link.has-focus,
  168. .wp-block-button.is-style-outline.wp-block-button__link:focus,
  169. .wp-block-button.is-style-outline.wp-block-button__link:hover,
  170. .wp-block-newspack-blocks-homepage-articles article .cat-links a:active,
  171. .wp-block-newspack-blocks-homepage-articles article .cat-links a:hover,
  172. .wp-block-newspack-blocks-homepage-articles article .entry-meta a:active,
  173. .wp-block-newspack-blocks-homepage-articles article .entry-meta a:hover,
  174. .wp-block-newspack-blocks-homepage-articles article .entry-title a:hover,
  175. a:hover', 'color', 'bg', 3 ),
  176. // Border-color (forms)
  177. // Needs contrast against `bg` with less contrast
  178. array( 'input[type="color"]:focus,
  179. input[type="date"]:focus,
  180. input[type="datetime"]:focus,
  181. input[type="datetime-local"]:focus,
  182. input[type="email"]:focus,
  183. input[type="month"]:focus,
  184. input[type="number"]:focus,
  185. input[type="password"]:focus,
  186. input[type="range"]:focus,
  187. input[type="search"]:focus,
  188. input[type="tel"]:focus,
  189. input[type="text"]:focus,
  190. input[type="time"]:focus,
  191. input[type="url"]:focus,
  192. input[type="week"]:focus,
  193. textarea:focus', 'border-color', 'bg', 3 ),
  194. /**
  195. * Utility Classes
  196. */
  197. // Background-color
  198. array( '.has-primary-background-color[class]', 'background-color' ),
  199. // Text-color
  200. // Needs contrast against `bg`
  201. array( '.has-primary-color[class]', 'color', 'bg' ),
  202. ), __( 'Link Color' ) );
  203. // Text Color (Gray)
  204. // $config-global--color-foreground-default
  205. add_color_rule( 'txt', '#444444', array(
  206. // Background-color
  207. array( 'body .widget_eu_cookie_law_widget #eu-cookie-law.negative', 'background-color' ),
  208. // Text-color
  209. // Needs contrast against `bg` with more contrast
  210. array( '.comment-meta .comment-metadata,
  211. .main-navigation,
  212. .screen-reader-text:focus,
  213. .site-branding,
  214. .wp-block-code,
  215. .wp-block-code pre,
  216. .wp-block-pullquote,
  217. body,
  218. body .widget_eu_cookie_law_widget #eu-cookie-law', 'color', 'bg', 7 ),
  219. // Text-color (forms)
  220. // Needs contrast against form background-color (which is always white)
  221. array( 'body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept,
  222. input[type="color"],
  223. input[type="color"]:focus,
  224. input[type="date"],
  225. input[type="date"]:focus,
  226. input[type="datetime"],
  227. input[type="datetime"]:focus,
  228. input[type="datetime-local"],
  229. input[type="datetime-local"]:focus,
  230. input[type="email"],
  231. input[type="email"]:focus,
  232. input[type="month"],
  233. input[type="month"]:focus,
  234. input[type="number"],
  235. input[type="number"]:focus,
  236. input[type="password"],
  237. input[type="password"]:focus,
  238. input[type="range"],
  239. input[type="range"]:focus,
  240. input[type="search"],
  241. input[type="search"]:focus,
  242. input[type="tel"],
  243. input[type="tel"]:focus,
  244. input[type="text"],
  245. input[type="text"]:focus,
  246. input[type="time"],
  247. input[type="time"]:focus,
  248. input[type="url"],
  249. input[type="url"]:focus,
  250. input[type="week"],
  251. input[type="week"]:focus,
  252. textarea,
  253. textarea:focus', 'color', '#ffffff', 8 ),
  254. // Text-color
  255. // Needs contrast against `bg` with less contrast (dim)
  256. array( '.a8c-posts-list__item .a8c-posts-list-item__meta,
  257. .entry-footer,
  258. .entry-meta,
  259. .footer-navigation .footer-menu,
  260. .site-info,
  261. .wp-block-image figcaption,
  262. .wp-block-latest-comments .wp-block-latest-comments__comment-date,
  263. .wp-block-latest-posts .wp-block-latest-posts__post-date,
  264. .wp-block-newspack-blocks-homepage-articles article .cat-links,
  265. .wp-block-newspack-blocks-homepage-articles article .entry-meta,
  266. .wp-block-pullquote .wp-block-pullquote__citation,
  267. .wp-block-pullquote cite,
  268. .wp-block-pullquote footer,
  269. .wp-block-quote .wp-block-quote__citation,
  270. .wp-block-quote cite,
  271. .wp-block-quote footer,
  272. .wp-block-quote.is-large .wp-block-quote__citation,
  273. .wp-block-quote.is-large cite,
  274. .wp-block-quote.is-large footer,
  275. .wp-block-quote.is-style-large .wp-block-quote__citation,
  276. .wp-block-quote.is-style-large cite,
  277. .wp-block-quote.is-style-large footer,
  278. .wp-block-video figcaption,
  279. figcaption', 'color', 'bg', 4 ),
  280. // Border-color
  281. // Needs contrast against `bg` with more contrast
  282. array( '.wp-block-code,
  283. body .widget_eu_cookie_law_widget #eu-cookie-law,
  284. input[type="color"],
  285. input[type="date"],
  286. input[type="datetime"],
  287. input[type="datetime-local"],
  288. input[type="email"],
  289. input[type="month"],
  290. input[type="number"],
  291. input[type="password"],
  292. input[type="range"],
  293. input[type="search"],
  294. input[type="tel"],
  295. input[type="text"],
  296. input[type="time"],
  297. input[type="url"],
  298. input[type="week"],
  299. select,
  300. textarea', 'border-color', 'bg', 7 ),
  301. // Border-top-color
  302. // Needs contrast against `bg` with more contrast
  303. array( '.comment-list .children > li,
  304. .comment-list > li,
  305. .wp-block-pullquote', 'border-top-color', 'bg', 7 ),
  306. // Border-bottom-color
  307. // Needs contrast against `bg` with more contrast
  308. array( '.comment-list,
  309. .wp-block-pullquote,
  310. hr,
  311. hr.wp-block-separator', 'border-bottom-color', 'bg', 7 ),
  312. // Text-color
  313. // Needs contrast against `bg` with more contrast
  314. array( 'hr.wp-block-separator.is-style-dots:before', 'color', 'bg', 7 ),
  315. // Background-color
  316. // Needs contrast against `bg` with more contrast
  317. array( 'body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept.has-focus,
  318. body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept:focus,
  319. body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept:hover', 'background-color', 'bg', 7 ),
  320. /**
  321. * Utility Classes
  322. */
  323. // Foreground
  324. // Needs contrast against `bg`
  325. array( '.has-foreground-color[class]', 'color', 'bg' ),
  326. array( '.has-foreground-background-color[class]', 'background-color' ),
  327. // Text-color darkened
  328. array( '.has-foreground-dark-color[class]', 'color', '-1' ),
  329. // Background-color darkened
  330. array( '.has-foreground-dark-background-color[class]', 'background-color', '-1' ),
  331. // Text-color brightened
  332. array( '.has-foreground-light-color[class]', 'color', '+2' ),
  333. // Background-color brightened
  334. array( '.has-foreground-light-background-color[class]', 'background-color', '+2' ),
  335. ), __( 'Text Color' ) );
  336. // Accent Color (Red)
  337. // $config-global--color-secondary-default
  338. add_color_rule( 'fg1', '#ff0000', array(
  339. /**
  340. * Utility Classes
  341. */
  342. // Text-color
  343. // Needs contrast against `bg`
  344. array( '.has-secondary-color[class]', 'color', 'bg' ),
  345. // Background-color
  346. array( '.has-secondary-background-color[class]', 'background-color' ),
  347. ), __( 'Secondary Color' ) );