wpcom-colors.php 17 KB

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