wpcom-colors.php 16 KB

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