wpcom-colors.php 16 KB

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