wpcom-colors.php 13 KB

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