wpcom-colors.php 16 KB

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