wpcom-colors.php 12 KB

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