wpcom-colors.php 17 KB

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