wpcom-colors.php 13 KB

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