wpcom-colors.php 15 KB

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