wpcom-colors.php 15 KB

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