wpcom-colors.php 13 KB

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