wpcom-colors.php 13 KB

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