wpcom-colors.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  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. button,
  59. button.has-focus,
  60. button:focus,
  61. button:hover,
  62. button[data-load-more-btn],
  63. input.has-focus[type="submit"],
  64. input:focus[type="submit"],
  65. input:hover[type="submit"],
  66. input[type="submit"],
  67. .footer-navigation .footer-menu,
  68. .main-navigation,
  69. .main-navigation > div > ul > li.current-menu-item > a,
  70. .main-navigation > div > ul > li:hover li > a,
  71. .main-navigation a,
  72. .main-navigation a:link,
  73. .main-navigation a:visited,
  74. .site-branding,
  75. .site-info,
  76. .site-title,
  77. .social-navigation a',
  78. 'color',
  79. ),
  80. /**
  81. * Utility Classes
  82. */
  83. // Text-color
  84. array(
  85. '.has-foreground-background-color,
  86. .has-foreground-background-color.has-background-dim,
  87. .has-foreground-dark-background-color,
  88. .has-foreground-dark-background-color.has-background-dim,
  89. .has-foreground-light-background-color,
  90. .has-foreground-light-background-color.has-background-dim,
  91. .has-primary-background-color,
  92. .has-primary-background-color.has-background-dim,
  93. .has-secondary-background-color,
  94. .has-secondary-background-color.has-background-dim,
  95. .has-background-color,
  96. .has-background-dark-color,
  97. .has-background-light-color',
  98. 'color',
  99. ),
  100. // Background-color
  101. array(
  102. '.has-background-background-color,
  103. .has-background-background-color.has-background-dim',
  104. 'background-color',
  105. ),
  106. // Background-color darkened
  107. array( '.has-background-dark-color', 'color', '-1' ),
  108. array(
  109. '.has-background-dark-background-color,
  110. .has-background-dark-background-color.has-background-dim',
  111. 'background-color',
  112. '-1',
  113. ),
  114. // Background-color lightened
  115. array( '.has-background-light-color', 'color', '+1' ),
  116. array(
  117. '.has-background-light-background-color,
  118. .has-background-light-background-color.has-background-dim',
  119. 'background-color',
  120. '+1',
  121. ),
  122. /**
  123. * Grays
  124. * Uses a slightly darker color
  125. */
  126. // Border-color
  127. array(
  128. '.wp-block-code,
  129. .wp-block-table td,
  130. .wp-block-table th,
  131. body .widget_eu_cookie_law_widget #eu-cookie-law,
  132. input[type="color"],
  133. input[type="date"],
  134. input[type="datetime"],
  135. input[type="datetime-local"],
  136. input[type="email"],
  137. input[type="month"],
  138. input[type="number"],
  139. input[type="password"],
  140. input[type="range"],
  141. input[type="search"],
  142. input[type="tel"],
  143. input[type="text"],
  144. input[type="time"],
  145. input[type="url"],
  146. input[type="week"],
  147. select,
  148. table td,
  149. table th,
  150. textarea',
  151. 'border-color',
  152. '-1',
  153. ),
  154. // Border-top-color
  155. array(
  156. '.comment-list .children > li,
  157. .comment-list > li,
  158. .wp-block-pullquote',
  159. 'border-top-color',
  160. '-1',
  161. ),
  162. // Color
  163. array( 'hr.wp-block-separator.is-style-dots:before', 'color', '-1' ),
  164. // Background-color
  165. array(
  166. 'body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept.has-focus,
  167. body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept:focus,
  168. body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept:hover',
  169. '-1',
  170. ),
  171. /**
  172. * Menu Hovers
  173. * Uses a slightly less opaque color
  174. */
  175. // Text-color
  176. array(
  177. '#masthead a:hover,
  178. .site-title a:hover,
  179. .social-navigation a:hover,
  180. .footer-navigation .footer-menu a:hover,
  181. .site-info a:hover',
  182. 'color',
  183. 0.8,
  184. ),
  185. // Background-color
  186. array(
  187. '.main-navigation #toggle-menu:active,
  188. .main-navigation #toggle-menu:focus,
  189. .main-navigation #toggle-menu:hover',
  190. 'background-color',
  191. 0.8,
  192. ),
  193. ),
  194. __( 'Background Color' )
  195. );
  196. // Link Color
  197. // $config-global--color-primary-default
  198. add_color_rule(
  199. 'link',
  200. '#C04239',
  201. array(
  202. // Background-color
  203. array(
  204. '.a8c-posts-list-item__featured span,
  205. .a8c-posts-list__view-all:focus,
  206. .a8c-posts-list__view-all:hover,
  207. .button:focus,
  208. .button:hover,
  209. .has-focus.a8c-posts-list__view-all,
  210. .has-focus.button,
  211. .has-focus.wp-block-button__link,
  212. .has-focus.wp-block-file__button,
  213. .sticky-post,
  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-button__link,
  359. .wp-block-cover,
  360. .wp-block-cover-image,
  361. .wp-block-cover-image.has-background-dim:not([class*="background-color"]),
  362. .wp-block-cover.has-background-dim:not([class*="background-color"]),
  363. .wp-block-file .wp-block-file__button,
  364. .wp-block-file__button,
  365. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept,
  366. body .widget_eu_cookie_law_widget #eu-cookie-law.negative,
  367. button,
  368. button[data-load-more-btn],
  369. input[type="submit"],
  370. .main-navigation > div > ul > li > .sub-menu,
  371. .main-navigation > div > ul > li:hover li > a,
  372. .main-navigation > div > ul > li.focus li > a,
  373. .main-navigation > div > ul > li.current-menu-item li > a',
  374. 'background-color',
  375. ),
  376. // Border-color
  377. array(
  378. 'input[type="color"]:focus,
  379. input[type="date"]:focus,
  380. input[type="datetime"]:focus,
  381. input[type="datetime-local"]:focus,
  382. input[type="email"]:focus,
  383. input[type="month"]:focus,
  384. input[type="number"]:focus,
  385. input[type="password"]:focus,
  386. input[type="range"]:focus,
  387. input[type="search"]:focus,
  388. input[type="tel"]:focus,
  389. input[type="text"]:focus,
  390. input[type="time"]:focus,
  391. input[type="url"]:focus,
  392. input[type="week"]:focus,
  393. textarea:focus',
  394. 'border-color',
  395. ),
  396. // Border-top-color
  397. array( '.wp-block-pullquote', 'border-top-color' ),
  398. // Border-bottom-color
  399. array(
  400. '.comment-list,
  401. .wp-block-pullquote,
  402. hr,
  403. hr.wp-block-separator',
  404. 'border-bottom-color',
  405. '-1',
  406. ),
  407. /**
  408. * Utility Classes
  409. */
  410. // Foreground
  411. array(
  412. '.has-background-background-color,
  413. .has-background-background-color.has-background-dim,
  414. .has-background-dark-background-color,
  415. .has-background-dark-background-color.has-background-dim,
  416. .has-background-light-background-color,
  417. .has-background-light-background-color.has-background-dim,
  418. .has-foreground-color',
  419. 'color',
  420. ),
  421. array(
  422. '.has-background-dim,
  423. .has-foreground-background-color,
  424. .has-foreground-background-color.has-background-dim',
  425. 'background-color',
  426. ),
  427. // Text-color darkened
  428. array( '.has-foreground-dark-color[class]', 'color', '-1' ),
  429. // Background-color darkened
  430. array( '.has-foreground-dark-background-color[class]', 'background-color', '-1' ),
  431. // Text-color brightened
  432. array( '.has-foreground-light-color[class]', 'color', '+2' ),
  433. // Background-color brightened
  434. array( '.has-foreground-light-background-color[class]', 'background-color', '+2' ),
  435. /**
  436. * Gray (Same as text color)
  437. */
  438. // Text-color
  439. array(
  440. '.a8c-posts-list__item .a8c-posts-list-item__meta,
  441. .comments-area .reply,
  442. .entry-footer,
  443. .entry-meta,
  444. .has-foreground-light-color[class],
  445. .post-navigation a,
  446. .wp-block-image figcaption,
  447. .wp-block-latest-comments .wp-block-latest-comments__comment-date,
  448. .wp-block-latest-posts .wp-block-latest-posts__post-date,
  449. .wp-block-newspack-blocks-homepage-articles article .cat-links,
  450. .wp-block-newspack-blocks-homepage-articles article .entry-meta,
  451. .wp-block-pullquote .wp-block-pullquote__citation,
  452. .wp-block-pullquote cite,
  453. .wp-block-pullquote footer,
  454. .wp-block-quote .wp-block-quote__citation,
  455. .wp-block-quote cite,
  456. .wp-block-quote footer,
  457. .wp-block-quote.is-large .wp-block-quote__citation,
  458. .wp-block-quote.is-large cite,
  459. .wp-block-quote.is-large footer,
  460. .wp-block-quote.is-style-large .wp-block-quote__citation,
  461. .wp-block-quote.is-style-large cite,
  462. .wp-block-quote.is-style-large footer,
  463. .wp-block-video figcaption,
  464. figcaption',
  465. 'color',
  466. ),
  467. ),
  468. __( 'Text Color' )
  469. );
  470. // Accent Color
  471. // $config-global--color-secondary-default
  472. add_color_rule(
  473. 'fg1',
  474. '#FFFFFF',
  475. array(
  476. /**
  477. * Utility Classes
  478. */
  479. // Text-color
  480. array( '.has-secondary-color', 'color' ),
  481. // Background-color
  482. array(
  483. '.has-secondary-background-color,
  484. .has-secondary-background-color.has-background-dim',
  485. 'background-color',
  486. ),
  487. ),
  488. __( 'Secondary Color' )
  489. );
  490. /**
  491. * Custom CSS
  492. */
  493. function brompton_custom_colors_extra_css() {
  494. $colors_array = get_theme_mod( 'colors_manager' );
  495. $bg = $colors_array['colors']['bg'];
  496. ?>
  497. input[type="color"],
  498. input[type="color"]:focus,
  499. input[type="date"],
  500. input[type="date"]:focus,
  501. input[type="datetime"],
  502. input[type="datetime"]:focus,
  503. input[type="datetime-local"],
  504. input[type="datetime-local"]:focus,
  505. input[type="email"],
  506. input[type="email"]:focus,
  507. input[type="month"],
  508. input[type="month"]:focus,
  509. input[type="number"],
  510. input[type="number"]:focus,
  511. input[type="password"],
  512. input[type="password"]:focus,
  513. input[type="range"],
  514. input[type="range"]:focus,
  515. input[type="search"],
  516. input[type="search"]:focus,
  517. input[type="tel"],
  518. input[type="tel"]:focus,
  519. input[type="text"],
  520. input[type="text"]:focus,
  521. input[type="time"],
  522. input[type="time"]:focus,
  523. input[type="url"],
  524. input[type="url"]:focus,
  525. input[type="week"],
  526. input[type="week"]:focus,
  527. textarea,
  528. textarea:focus {
  529. color: black;
  530. background: white;
  531. }
  532. @media screen and (min-width: 560px) {
  533. .main-navigation > div > ul > li:hover li > a,
  534. .main-navigation > div > ul > li.focus li > a,
  535. .main-navigation > div > ul > li.current-menu-item li > a {
  536. border-top-color: currentColor;
  537. }
  538. }
  539. <?php
  540. }
  541. add_theme_support( 'custom_colors_extra_css', 'brompton_custom_colors_extra_css' );
  542. /**
  543. * Featured Varia Palettes
  544. */
  545. // Light
  546. add_color_palette(
  547. array(
  548. '#FFFFFF',
  549. '#1D1E1E',
  550. '#C8133E',
  551. '#4E2F4B',
  552. ),
  553. 'Light'
  554. );
  555. // Medium
  556. add_color_palette(
  557. array(
  558. '#EEF4F7',
  559. '#242527',
  560. '#35845D',
  561. '#233252',
  562. ),
  563. 'Medium'
  564. );
  565. // Dark
  566. add_color_palette(
  567. array(
  568. '#1F2527',
  569. '#FFFFFF',
  570. '#9FD3E8',
  571. '#FBE6AA',
  572. ),
  573. 'Dark'
  574. );