wpcom-colors.php 16 KB

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