wpcom-colors.php 16 KB

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