wpcom-colors.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. <?php
  2. /* Custom Colors: Rivington */
  3. // Background Color
  4. // $config-global--color-background-default
  5. add_color_rule(
  6. 'bg',
  7. '#060f29',
  8. array(
  9. // Background-color
  10. array(
  11. '.screen-reader-text:focus,
  12. body,
  13. body .widget_eu_cookie_law_widget #eu-cookie-law,
  14. body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept,
  15. .main-navigation > div > ul > li > .sub-menu,
  16. .site-header .main-navigation > div > ul > li:hover li > a,
  17. .site-header .main-navigation > div > ul > li.focus li > a,
  18. .site-header .main-navigation > div > ul > li.current-menu-item li > a,
  19. .site-header .main-navigation > div > ul > li.current-menu-item li.current-menu-item > a,
  20. .site-header .main-navigation > div > ul > li.current-menu-item li.focus > a,
  21. .site-header .main-navigation > div > ul > li.current-menu-item li:hover > a,
  22. .site-header .main-navigation > div > ul > li.focus li.current-menu-item > a,
  23. .site-header .main-navigation > div > ul > li.focus li.focus > a,
  24. .site-header .main-navigation > div > ul > li.focus li:hover > a,
  25. .site-header .main-navigation > div > ul > li:hover li.current-menu-item > a,
  26. .site-header .main-navigation > div > ul > li:hover li.focus > a,
  27. .site-header .main-navigation > div > ul > li:hover li:hover > a,
  28. .site-header .main-navigation > div > ul > li .sub-menu a,
  29. .main-navigation > div > ul > li.current-menu-item li.current-menu-item > a,
  30. .mobile-nav-side .site-header #site-navigation.main-navigation .woocommerce-menu-container,
  31. .mobile-nav-side .site-header #site-navigation.main-navigation > div',
  32. 'background-color',
  33. ),
  34. // Text-color
  35. array(
  36. '.a8c-posts-list-item__featured span,
  37. .a8c-posts-list__view-all,
  38. .a8c-posts-list__view-all:focus,
  39. .a8c-posts-list__view-all:hover,
  40. .button,
  41. .button:focus,
  42. .button:hover,
  43. .has-focus.a8c-posts-list__view-all,
  44. .has-focus.button,
  45. .has-focus.wp-block-button__link,
  46. .has-focus.wp-block-file__button,
  47. .sticky-post,
  48. .wp-block-button__link,
  49. .wp-block-button__link:focus,
  50. .wp-block-button__link:hover,
  51. .wp-block-button.is-style-outline.wp-block-button__link,
  52. .wp-block-button.is-style-outline .wp-block-button__link,
  53. .wp-block-file .wp-block-file__button,
  54. .wp-block-file a.wp-block-file__button:active,
  55. .wp-block-file a.wp-block-file__button:focus,
  56. .wp-block-file a.wp-block-file__button:hover,
  57. .wp-block-file a.wp-block-file__button:visited,
  58. .wp-block-file__button,
  59. .wp-block-file__button:focus,
  60. .wp-block-file__button:hover,
  61. .wp-block-search .wp-block-search__button,
  62. .wp-block-pullquote.is-style-solid-color,
  63. table.is-style-stripes tbody tr:nth-child(odd),
  64. .wp-block-table.is-style-stripes tbody tr:nth-child(odd),
  65. .wp-block-cover-image:not([class="has-background-background-color"]) .wp-block-cover-image-text,
  66. .wp-block-cover-image:not([class="has-background-background-color"]) .wp-block-cover-text,
  67. .wp-block-cover-image:not([class="has-background-background-color"]) .wp-block-cover__inner-container,
  68. .wp-block-cover:not([class="has-background-background-color"]) .wp-block-cover-image-text,
  69. .wp-block-cover:not([class="has-background-background-color"]) .wp-block-cover-text,
  70. .wp-block-cover:not([class="has-background-background-color"]) .wp-block-cover__inner-container,
  71. .wp-block-cover.has-background-dim,
  72. .wp-block-cover-image.has-background-dim,
  73. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept,
  74. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:focus,
  75. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:hover,
  76. body .widget_eu_cookie_law_widget #eu-cookie-law input.has-focus.accept,
  77. body .widget_eu_cookie_law_widget #eu-cookie-law.negative,
  78. button,
  79. button.has-focus,
  80. button:focus,
  81. button:hover,
  82. button[data-load-more-btn],
  83. input.has-focus[type="submit"],
  84. input:focus[type="submit"],
  85. input:hover[type="submit"]',
  86. 'color',
  87. ),
  88. /**
  89. * Utility Classes
  90. */
  91. // Text-color
  92. // Needs contrast against `link` (primary)
  93. array(
  94. '.has-primary-background-color[class],
  95. .has-secondary-background-color[class],
  96. .has-foreground-background-color[class],
  97. .has-foreground-dark-background-color[class],
  98. .has-foreground-light-background-color[class],
  99. .has-background-color[class],
  100. .has-background-dark-color[class],
  101. .has-background-light-color[class]',
  102. 'color',
  103. ),
  104. // Background-color
  105. array( '.has-background-background-color[class]', 'background-color' ),
  106. // Background-color darkened
  107. array( '.has-background-dark-background-color[class]', 'background-color', '-1' ),
  108. // Background-color lightened
  109. array( '.has-background-light-background-color[class]', 'background-color', '+1' ),
  110. /**
  111. * Grays
  112. * Uses a slightly darker color
  113. */
  114. // Border-color
  115. array(
  116. '.wp-block-code,
  117. body .widget_eu_cookie_law_widget #eu-cookie-law,
  118. input[type="color"],
  119. input[type="date"],
  120. input[type="datetime"],
  121. input[type="datetime-local"],
  122. input[type="email"],
  123. input[type="month"],
  124. input[type="number"],
  125. input[type="password"],
  126. input[type="range"],
  127. input[type="search"],
  128. input[type="tel"],
  129. input[type="text"],
  130. input[type="time"],
  131. input[type="url"],
  132. input[type="week"],
  133. select,
  134. textarea,
  135. .main-navigation > div > ul > li > .sub-menu > li > a,
  136. .main-navigation > div > ul > li > .sub-menu > li:first-child > a,
  137. .main-navigation > div > ul > li > .sub-menu > li:last-child > a',
  138. 'border-color',
  139. '-1',
  140. ),
  141. // Border-top-color
  142. array(
  143. '.comment-list .children > li,
  144. .comment-list > li,
  145. .wp-block-pullquote',
  146. 'border-top-color',
  147. '-1',
  148. ),
  149. // Border-bottom-color
  150. array(
  151. '.comment-list,
  152. .wp-block-pullquote,
  153. hr,
  154. hr.wp-block-separator',
  155. 'border-bottom-color',
  156. '-1',
  157. ),
  158. // Color
  159. array( 'hr.wp-block-separator.is-style-dots:before', 'color', '-1' ),
  160. ),
  161. __( 'Background Color' )
  162. );
  163. // Link Color
  164. // $config-global--color-primary-default
  165. add_color_rule(
  166. 'link',
  167. '#CAAB57',
  168. array(
  169. // Background-color
  170. array(
  171. '.a8c-posts-list-item__featured span,
  172. .a8c-posts-list__view-all,
  173. .button,
  174. .main-navigation #toggle:focus + #toggle-menu,
  175. .sticky-post,
  176. .wp-block-button__link,
  177. .wp-block-file .wp-block-file__button,
  178. .wp-block-file__button,
  179. .wp-block-pullquote.is-style-solid-color,
  180. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept,
  181. button,
  182. button[data-load-more-btn],
  183. .wp-block-search .wp-block-search__button,
  184. .wp-block-search .wp-block-search__button:focus,
  185. .wp-block-search .wp-block-search__button:hover,
  186. .wp-block-search .wp-block-search__button:not(.has-background):hover,
  187. input[type="submit"]',
  188. 'background-color',
  189. ),
  190. // Text-color
  191. array(
  192. '.a8c-posts-list .a8c-posts-list-item__title a:active,
  193. .a8c-posts-list .a8c-posts-list-item__title a:focus,
  194. .a8c-posts-list .a8c-posts-list-item__title a:hover,
  195. .entry-title a:active,
  196. .entry-title a:focus,
  197. .entry-title a:hover,
  198. .main-navigation a:hover,
  199. .page-title a:active,
  200. .page-title a:focus,
  201. .page-title a:hover,
  202. .site-title a:hover,
  203. .wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color),
  204. .wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color):active,
  205. .wp-block-button.is-style-outline.wp-block-button__link:not(.has-text-color),
  206. .wp-block-button.is-style-outline.wp-block-button__link:not(.has-text-color):active,
  207. .wp-block-newspack-blocks-homepage-articles article .entry-title a,
  208. .wp-block-newspack-blocks-homepage-articles article .entry-title a:active,
  209. .wp-block-newspack-blocks-homepage-articles article .entry-title a:focus,
  210. .wp-block-newspack-blocks-homepage-articles article .entry-title a:hover,
  211. a,
  212. .site-header .main-navigation > div > ul > li.current-menu-item li > a,
  213. .site-header .main-navigation > div > ul > li.focus li > a,
  214. .site-header .main-navigation > div > ul > li:hover li > a,
  215. .site-header .main-navigation > div > ul > li:hover > a,
  216. .site-header .main-navigation > div > ul > li.focus > a,
  217. .site-header .main-navigation > div > ul > li.current-menu-item > a,
  218. .site-header .main-navigation > div > ul > li > .sub-menu > li:hover > a',
  219. 'color',
  220. ),
  221. // Border color
  222. array( '.wp-block-search .wp-block-search__input:focus,', 'border-color' ),
  223. // Border color left
  224. array( '.wp-block-quote', 'border-left-color' ),
  225. // Border color right
  226. array(
  227. '.wp-block-quote[style*="text-align: right"],
  228. .wp-block-quote[style*="text-align:right"]',
  229. 'border-right-color',
  230. ),
  231. // Border color bottom
  232. array(
  233. '.site-header .main-navigation > div > ul > li.current-menu-item > ul:before,
  234. .site-header .main-navigation > div > ul > li.focus > ul:before,
  235. .site-header .main-navigation > div > ul > li:hover > ul:before',
  236. 'border-bottom-color',
  237. ),
  238. /**
  239. * Utility Classes
  240. */
  241. // Background-color
  242. array( '.has-primary-background-color[class]', 'background-color' ),
  243. // Text-color
  244. array( '.has-primary-color[class]', 'color' ),
  245. ),
  246. __( 'Link Color' )
  247. );
  248. // Text Color
  249. // $config-global--color-foreground-default
  250. add_color_rule(
  251. 'txt',
  252. '#f2f2f2',
  253. array(
  254. // Text-color
  255. array(
  256. '.comment-meta .comment-metadata,
  257. .main-navigation,
  258. .main-navigation a,
  259. .main-navigation a:link,
  260. .main-navigation a:visited,
  261. .screen-reader-text:focus,
  262. .site-branding,
  263. .site-title,
  264. .social-navigation a,
  265. .wp-block-code,
  266. .wp-block-code pre,
  267. .wp-block-pullquote,
  268. body,
  269. body .widget_eu_cookie_law_widget #eu-cookie-law,
  270. body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept,
  271. .site-header .main-navigation > div > ul > li.current-menu-item li > a,
  272. .site-header .main-navigation > div > ul > li.focus li > a,
  273. .site-header .main-navigation > div > ul > li:hover li > a',
  274. 'color',
  275. ),
  276. // Background-color
  277. array(
  278. '.wp-block-cover.has-background-dim:not([class*="background-color"]),
  279. .wp-block-cover-image.has-background-dim:not([class*="background-color"]),
  280. .has-foreground-background-color[class],
  281. table.is-style-stripes tbody tr:nth-child(odd),
  282. .wp-block-table.is-style-stripes tbody tr:nth-child(odd),
  283. body .widget_eu_cookie_law_widget #eu-cookie-law.negative',
  284. 'background-color',
  285. ),
  286. // Border-color with less opacity (dim)
  287. array( '.wp-block-search .wp-block-search__input', 'border-color', 0.8 ),
  288. /**
  289. * Utility Classes
  290. */
  291. // Foreground
  292. array( '.has-foreground-color[class]', 'color' ),
  293. array( '.has-foreground-background-color[class]', 'background-color' ),
  294. // Text color
  295. array(
  296. '.has-background-background-color[class],
  297. .has-background-light-background-color[class],
  298. .has-background-dark-background-color[class]',
  299. 'color',
  300. ),
  301. // Text-color darkened
  302. array( '.has-foreground-dark-color[class]', 'color', '-1' ),
  303. // Background-color darkened
  304. array( '.has-foreground-dark-background-color[class]', 'background-color', '-1' ),
  305. // Text-color brightened
  306. array( '.has-foreground-light-color[class]', 'color', '+2' ),
  307. // Background-color brightened
  308. array( '.has-foreground-light-background-color[class]', 'background-color', '+2' ),
  309. /**
  310. * Gray (Same as text color)
  311. */
  312. // Text-color
  313. array(
  314. '.a8c-posts-list__item .a8c-posts-list-item__meta,
  315. .comment-notes,
  316. .entry-footer,
  317. .entry-meta,
  318. .footer-navigation .footer-menu,
  319. .has-foreground-light-color[class],
  320. .post-navigation .meta-nav,
  321. .site-info,
  322. .widget_archive ul li,
  323. .widget_categories ul li,
  324. .widget_meta ul li,
  325. .widget_nav_menu ul li,
  326. .widget_pages ul li,
  327. .widget_recent_comments ul li,
  328. .widget_recent_entries ul li,
  329. .widget_rss ul li,
  330. .wp-block-image figcaption,
  331. .wp-block-latest-comments .wp-block-latest-comments__comment-date,
  332. .wp-block-latest-posts .wp-block-latest-posts__post-date,
  333. .wp-block-newspack-blocks-homepage-articles article .cat-links,
  334. .wp-block-newspack-blocks-homepage-articles article .entry-meta,
  335. .wp-block-pullquote .wp-block-pullquote__citation,
  336. .wp-block-pullquote cite,
  337. .wp-block-pullquote footer,
  338. .wp-block-quote .wp-block-quote__citation,
  339. .wp-block-quote cite,
  340. .wp-block-quote footer,
  341. .wp-block-quote.is-large .wp-block-quote__citation,
  342. .wp-block-quote.is-large cite,
  343. .wp-block-quote.is-large footer,
  344. .wp-block-quote.is-style-large .wp-block-quote__citation,
  345. .wp-block-quote.is-style-large cite,
  346. .wp-block-quote.is-style-large footer,
  347. .wp-block-video figcaption,
  348. figcaption',
  349. 'color',
  350. ),
  351. /**
  352. * Hover States
  353. */
  354. // Background-color
  355. array(
  356. '.a8c-posts-list__view-all:focus,
  357. .a8c-posts-list__view-all:hover,
  358. .button:focus,
  359. .button:hover,
  360. .has-focus.a8c-posts-list__view-all,
  361. .has-focus.button,
  362. .has-focus.wp-block-button__link,
  363. .has-focus.wp-block-file__button,
  364. .wp-block-button__link:focus,
  365. .wp-block-button__link:hover,
  366. .wp-block-file__button:focus,
  367. .wp-block-file__button:hover,
  368. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:focus,
  369. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:hover,
  370. body .widget_eu_cookie_law_widget #eu-cookie-law input.has-focus.accept,
  371. button.has-focus,
  372. button:focus,
  373. button:hover,
  374. input.has-focus[type="submit"],
  375. input:focus[type="submit"],
  376. input:hover[type="submit"]',
  377. 'background-color',
  378. 0.7,
  379. ),
  380. // Text-color
  381. array(
  382. '.a8c-posts-list__item .a8c-posts-list-item__meta a:active,
  383. .a8c-posts-list__item .a8c-posts-list-item__meta a:hover,
  384. .comment-meta .comment-metadata a:active,
  385. .comment-meta .comment-metadata a:hover,
  386. .entry-footer a:active,
  387. .entry-footer a:hover,
  388. .entry-meta a:active,
  389. .entry-meta a:hover,
  390. .footer-navigation .footer-menu a:hover,
  391. .site-info a:hover,
  392. .social-navigation a:hover,
  393. .wp-block-button.is-style-outline .wp-block-button__link.has-focus,
  394. .wp-block-button.is-style-outline .wp-block-button__link:focus,
  395. .wp-block-button.is-style-outline .wp-block-button__link:hover,
  396. .wp-block-button.is-style-outline.wp-block-button__link.has-focus,
  397. .wp-block-button.is-style-outline.wp-block-button__link:focus,
  398. .wp-block-button.is-style-outline.wp-block-button__link:hover,
  399. .wp-block-newspack-blocks-homepage-articles article .cat-links a:active,
  400. .wp-block-newspack-blocks-homepage-articles article .cat-links a:focus,
  401. .wp-block-newspack-blocks-homepage-articles article .cat-links a:hover,
  402. .wp-block-newspack-blocks-homepage-articles article .entry-meta a:active,
  403. .wp-block-newspack-blocks-homepage-articles article .entry-meta a:focus,
  404. .wp-block-newspack-blocks-homepage-articles article .entry-meta a:hover,
  405. .wp-block-newspack-blocks-homepage-articles article .entry-title a:hover,
  406. .wp-block-newspack-blocks-homepage-articles article .more-link:active,
  407. .wp-block-newspack-blocks-homepage-articles article .more-link:focus,
  408. .wp-block-newspack-blocks-homepage-articles article .more-link:hover,
  409. a:hover',
  410. 'color',
  411. 0.7,
  412. ),
  413. // Border-color
  414. array(
  415. 'input[type="color"]:focus,
  416. input[type="date"]:focus,
  417. input[type="datetime"]:focus,
  418. input[type="datetime-local"]:focus,
  419. input[type="email"]:focus,
  420. input[type="month"]:focus,
  421. input[type="number"]:focus,
  422. input[type="password"]:focus,
  423. input[type="range"]:focus,
  424. input[type="search"]:focus,
  425. input[type="tel"]:focus,
  426. input[type="text"]:focus,
  427. input[type="time"]:focus,
  428. input[type="url"]:focus,
  429. input[type="week"]:focus,
  430. textarea:focus',
  431. 'border-color',
  432. 0.7,
  433. ),
  434. ),
  435. __( 'Text Color' )
  436. );
  437. // Accent Color
  438. // $config-global--color-secondary-default
  439. add_color_rule(
  440. 'fg1',
  441. '#EE4266',
  442. array(
  443. /**
  444. * Utility Classes
  445. */
  446. // Text-color
  447. array( '.has-secondary-color[class]', 'color' ),
  448. // Background-color
  449. array(
  450. '.has-secondary-background-color[class],
  451. input:hover[type="submit"],
  452. .main-navigation .button:focus,
  453. .main-navigation .button:hover,
  454. .main-navigation #toggle:focus + #toggle-menu,
  455. .has-secondary-background-color',
  456. 'background-color',
  457. ),
  458. ),
  459. __( 'Secondary Color' )
  460. );
  461. /**
  462. * Custom CSS
  463. */
  464. function rivington_custom_colors_extra_css() { ?>
  465. input[type="text"],
  466. input[type="email"],
  467. input[type="url"],
  468. input[type="password"],
  469. input[type="search"],
  470. input[type="number"],
  471. input[type="tel"],
  472. input[type="range"],
  473. input[type="date"],
  474. input[type="month"],
  475. input[type="week"],
  476. input[type="time"],
  477. input[type="datetime"],
  478. input[type="datetime-local"],
  479. input[type="color"],
  480. textarea {
  481. border-width: 1px;
  482. }
  483. @media screen and (min-width: 560px) {
  484. .main-navigation > div > ul > li > .sub-menu > li:first-child > a {
  485. border-top: 1px solid;
  486. }
  487. .main-navigation > div > ul > li > .sub-menu > li > a {
  488. border-left: 1px solid;
  489. border-right: 1px solid;
  490. }
  491. .main-navigation > div > ul > li > .sub-menu > li:last-child > a {
  492. border-bottom: 1px solid;
  493. }
  494. .site-header .main-navigation > div > ul > li.current-menu-item > ul::before,
  495. .site-header .main-navigation > div > ul > li.focus > ul::before,
  496. .site-header .main-navigation > div > ul > li:hover > ul::before {
  497. opacity: 0;
  498. }
  499. }
  500. <?php
  501. }
  502. add_theme_support( 'custom_colors_extra_css', 'rivington_custom_colors_extra_css' );
  503. /**
  504. * Featured Varia Palettes
  505. */
  506. // Light
  507. add_color_palette(
  508. array(
  509. '#FFFFFF',
  510. '#1D1E1E',
  511. '#C8133E',
  512. '#4E2F4B',
  513. ),
  514. 'Light'
  515. );
  516. // Medium
  517. add_color_palette(
  518. array(
  519. '#EEF4F7',
  520. '#242527',
  521. '#35845D',
  522. '#233252',
  523. ),
  524. 'Medium'
  525. );
  526. // Dark
  527. add_color_palette(
  528. array(
  529. '#1F2527',
  530. '#FFFFFF',
  531. '#9FD3E8',
  532. '#FBE6AA',
  533. ),
  534. 'Dark'
  535. );