wpcom-colors.php 14 KB

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