wpcom-colors.php 15 KB

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