wpcom-colors.php 13 KB

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