wpcom-colors.php 12 KB

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