wpcom-colors.php 17 KB

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