wpcom-colors.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <?php
  2. /*
  3. * Custom Colors: Seedlet
  4. */
  5. // Background Color
  6. // --global--color-background
  7. add_color_rule( 'bg', '#FFFFFF', array(
  8. // Background-color
  9. array( '.primary-navigation > div,
  10. .screen-reader-text:focus,
  11. .woo-navigation > div,
  12. .wp-block-navigation > .wp-block-navigation__container > .has-child > .wp-block-navigation__container,
  13. body,
  14. .primary-navigation > div > ul > li > .sub-menu,
  15. .woo-navigation > div > ul > li > .sub-menu', 'background-color' ),
  16. // Text-color
  17. array( '.a8c-posts-list-item__featured span,
  18. .a8c-posts-list__view-all,
  19. .a8c-posts-list__view-all:active,
  20. .a8c-posts-list__view-all:focus,
  21. .a8c-posts-list__view-all:hover,
  22. .button,
  23. .button:active,
  24. .button:focus,
  25. .button:hover,
  26. .has-focus.a8c-posts-list__view-all,
  27. .has-focus.button,
  28. .has-focus.wp-block-button__link,
  29. .reply a,
  30. .reply a.has-focus,
  31. .reply a:focus,
  32. .reply a:hover,
  33. .sticky-post,
  34. .wp-block-button__link,
  35. .wp-block-button__link:active,
  36. .wp-block-button__link:focus,
  37. .wp-block-button__link:hover,
  38. .wp-block-file .has-focus.wp-block-file__button,
  39. .wp-block-file .wp-block-file__button,
  40. .wp-block-file .wp-block-file__button:active,
  41. .wp-block-file .wp-block-file__button:focus,
  42. .wp-block-file .wp-block-file__button:hover,
  43. .wp-block-file a.wp-block-file__button:active,
  44. .wp-block-file a.wp-block-file__button:focus,
  45. .wp-block-file a.wp-block-file__button:hover,
  46. .wp-block-file a.wp-block-file__button:visited,
  47. .wp-block-pullquote.is-style-solid-color,
  48. button,
  49. button.has-focus,
  50. button:active,
  51. button:focus,
  52. button:hover,
  53. button[data-load-more-btn],
  54. input.has-focus[type="submit"],
  55. input:active[type="submit"],
  56. input:focus[type="submit"],
  57. input:hover[type="submit"],
  58. input[type="submit"]', 'color' ),
  59. // Text-shadow
  60. array( '.site-title a', 'text-shadow' ),
  61. /**
  62. * Utility Classes
  63. */
  64. // Text-color
  65. array( '.has-primary-background-color[class],
  66. .has-secondary-background-color[class],
  67. .has-foreground-background-color[class],
  68. .has-foreground-dark-background-color[class],
  69. .has-foreground-light-background-color[class],
  70. .has-background-color[class]', 'color' ),
  71. // Background-color
  72. array( '.has-background-background-color[class]', 'background-color' ),
  73. // Text-color darkened
  74. array( '.has-background-dark-color[class]', 'color', '-1' ),
  75. // Background-color darkened
  76. array( '.has-background-dark-background-color[class]', 'background-color', '-1' ),
  77. ), __( 'Background Color' ) );
  78. // Foreground Color
  79. // --global--color-background
  80. add_color_rule( 'txt', '#444444', array(
  81. // Text-color
  82. array( '.comment-meta .comment-metadata,
  83. .entry-footer,
  84. .entry-meta,
  85. .has-background-background-color[class],
  86. .has-background-dark-background-color[class],
  87. .has-foreground-color[class],
  88. .has-tertiary-background-color[class],
  89. .navigation,
  90. .pagination .nav-links > *,
  91. .post-navigation .meta-nav,
  92. .primary-navigation,
  93. .screen-reader-text:focus,
  94. .site-branding,
  95. .site-footer > .footer-navigation .footer-menu,
  96. .site-footer > .site-info,
  97. .social-navigation a,
  98. .social-navigation a:active,
  99. .woo-navigation,
  100. .wp-block-code,
  101. .wp-block-code pre,
  102. .wp-block-pullquote,
  103. .wp-block-search .wp-block-search__input,
  104. .wp-block-search .wp-block-search__input:focus,
  105. body,
  106. input[type="color"],
  107. input[type="color"]:focus,
  108. input[type="date"],
  109. input[type="date"]:focus,
  110. input[type="datetime"],
  111. input[type="datetime"]:focus,
  112. input[type="datetime-local"],
  113. input[type="datetime-local"]:focus,
  114. input[type="email"],
  115. input[type="email"]:focus,
  116. input[type="month"],
  117. input[type="month"]:focus,
  118. input[type="number"],
  119. input[type="number"]:focus,
  120. input[type="password"],
  121. input[type="password"]:focus,
  122. input[type="range"],
  123. input[type="range"]:focus,
  124. input[type="search"],
  125. input[type="search"]:focus,
  126. input[type="tel"],
  127. input[type="tel"]:focus,
  128. input[type="text"],
  129. input[type="text"]:focus,
  130. input[type="time"],
  131. input[type="time"]:focus,
  132. input[type="url"],
  133. input[type="url"]:focus,
  134. input[type="week"],
  135. input[type="week"]:focus,
  136. textarea,
  137. textarea:focus', 'color' ),
  138. // Background-color
  139. array( '.has-foreground-background-color[class],
  140. .wp-block-pullquote.is-style-solid-color', 'background-color' ),
  141. // Border-bottom-color
  142. array( '.pagination .nav-links > *.current', 'border-bottom-color' ),
  143. /**
  144. * Utility Classes
  145. */
  146. // Foreground
  147. array( '.has-foreground-color[class],
  148. .has-background-background-color[class],
  149. .has-background-dark-background-color[class],
  150. .has-background-light-background-color[class]', 'color' ),
  151. // Background
  152. array( '.has-foreground-background-color[class]', 'background-color' ),
  153. // Text-color darkened
  154. array( '.has-foreground-dark-color[class]', 'color', '-1' ),
  155. // Background-color darkened
  156. array( '.has-foreground-dark-background-color[class]', 'background-color', '-1' ),
  157. // Text-color brightened
  158. array( '.has-foreground-light-color[class]', 'color', '+2' ),
  159. // Background-color brightened
  160. array( '.has-foreground-light-background-color[class]', 'background-color', '+2' ),
  161. ), __( 'Foreground Color' ) );
  162. // Primary Color
  163. // --global--color-primary
  164. add_color_rule( 'link', '#000000', array(
  165. // Text-color
  166. array( '.entry-title,
  167. .navigation a,
  168. .navigation a:active,
  169. .primary-navigation .menu-item > a,
  170. .primary-navigation .menu-item > a:active,
  171. .primary-navigation > .button,
  172. .site-footer > .site-info a:focus,
  173. .site-footer > .site-info a:hover,
  174. .site-title,
  175. .woo-navigation .menu-item > a,
  176. .woo-navigation .menu-item > a:active,
  177. .woo-navigation > .button,
  178. .wp-block-a8c-blog-posts article .entry-title a,
  179. .wp-block-a8c-blog-posts article .entry-title a:active,
  180. .wp-block-newspack-blocks-homepage-articles article .entry-title a,
  181. .wp-block-newspack-blocks-homepage-articles article .entry-title a:active,
  182. a,
  183. a:active', 'color' ),
  184. // Background-color
  185. array( '.a8c-posts-list-item__featured span,
  186. .a8c-posts-list__view-all:active,
  187. .button:active,
  188. .wp-block-button__link:active,
  189. .wp-block-cover,
  190. .wp-block-cover-image,
  191. .wp-block-file .wp-block-file__button:active,
  192. button:active,
  193. input:active[type="submit"]', 'background-color' ),
  194. /**
  195. * Utility Classes
  196. */
  197. // Background-color
  198. array( '.has-primary-background-color[class],
  199. .has-foreground-dark-background-color[class]', 'background-color' ),
  200. // Text-color
  201. array( '.has-black-background-color[class],
  202. .has-foreground-dark-color[class],
  203. .has-primary-color[class]', 'color' ),
  204. ), __( 'Primary Color' ) );
  205. // Secondary Color
  206. // --global--color-secondary
  207. add_color_rule( 'fg1', '#3C8067', array(
  208. // Text-color
  209. array( '.a8c-posts-list__item .a8c-posts-list-item__meta a:active,
  210. .a8c-posts-list__item .a8c-posts-list-item__meta a:hover,
  211. .comment-meta .comment-metadata a:focus,
  212. .comment-meta .comment-metadata a:hover,
  213. .entry-footer a:focus,
  214. .entry-footer a:hover,
  215. .entry-meta a:focus,
  216. .entry-meta a:hover,
  217. .entry-title a:focus,
  218. .entry-title a:hover,
  219. .navigation a:focus,
  220. .navigation a:hover,
  221. .pagination .nav-links > a:hover,
  222. .site-footer > .footer-navigation .footer-menu a:focus,
  223. .site-footer > .footer-navigation .footer-menu a:hover,
  224. .site-title a:focus,
  225. .site-title a:hover,
  226. .social-navigation a:focus,
  227. .social-navigation a:hover,
  228. .woo-navigation .menu-item > a:focus,
  229. .woo-navigation .menu-item > a:hover,
  230. .woo-navigation .primary-menu > .menu-item:hover > a,
  231. .woo-navigation > .button:hover,
  232. .wp-block-a8c-blog-posts article .cat-links a:active,
  233. .wp-block-a8c-blog-posts article .cat-links a:hover,
  234. .wp-block-a8c-blog-posts article .entry-meta a:active,
  235. .wp-block-a8c-blog-posts article .entry-meta a:hover,
  236. .wp-block-a8c-blog-posts article .entry-title a:focus,
  237. .wp-block-a8c-blog-posts article .entry-title a:hover,
  238. .wp-block-button.is-style-outline .wp-block-button__link,
  239. .wp-block-button.is-style-outline .wp-block-button__link:active,
  240. .wp-block-button.is-style-outline.wp-block-button__link,
  241. .wp-block-button.is-style-outline.wp-block-button__link:active,
  242. .wp-block-navigation:not(.has-text-color) .wp-block-navigation-link > a:focus,
  243. .wp-block-navigation:not(.has-text-color) .wp-block-navigation-link > a:hover,
  244. .wp-block-newspack-blocks-homepage-articles article .cat-links a:active,
  245. .wp-block-newspack-blocks-homepage-articles article .cat-links a:hover,
  246. .wp-block-newspack-blocks-homepage-articles article .entry-meta a:active,
  247. .wp-block-newspack-blocks-homepage-articles article .entry-meta a:hover,
  248. .wp-block-newspack-blocks-homepage-articles article .entry-title a:focus,
  249. .wp-block-newspack-blocks-homepage-articles article .entry-title a:hover,
  250. .primary-navigation .menu-item > a:focus,
  251. .primary-navigation .menu-item > a:hover,
  252. .primary-navigation .primary-menu > .menu-item:hover > a,
  253. .primary-navigation > .button:hover,
  254. a:focus,
  255. a:hover', 'color' ),
  256. // Background-color
  257. array( '.a8c-posts-list__view-all,
  258. .button,
  259. .has-secondary-background-color[class],
  260. .reply a,
  261. .sticky-post,
  262. .wp-block-button__link,
  263. .wp-block-file .wp-block-file__button,
  264. button,
  265. button[data-load-more-btn],
  266. input[type="submit"]', 'background-color' ),
  267. // Border-bottom-color
  268. array( 'a', 'border-bottom-color' ),
  269. // Border-left-color
  270. array( '.wp-block-pullquote.is-style-large,
  271. .wp-block-quote', 'border-left-color' ),
  272. // Border-right-color
  273. array( '.wp-block-quote.has-text-align-right', 'border-right-color' ),
  274. // Outline-color
  275. array( '*:focus', 'outline-color' ),
  276. // Background-image
  277. array( '.site-title a', 'Background-image' ),
  278. // Text-decoration-color
  279. array( '.site-title > a', 'text-decoration-color' ),
  280. /**
  281. * Utility Classes
  282. */
  283. // Background-color
  284. array( '.has-secondary-background-color[class]', 'background-color' ),
  285. // Text-color
  286. array( '.has-secondary-color[class],
  287. .has-white-background-color[class],', 'color' ),
  288. /**
  289. * Button Hover Colors
  290. */
  291. // Background Color
  292. array( '.a8c-posts-list__view-all:focus,
  293. .a8c-posts-list__view-all:hover,
  294. .button:focus,
  295. .button:hover,
  296. .has-focus.a8c-posts-list__view-all,
  297. .has-focus.button,
  298. .has-focus.wp-block-button__link,
  299. .reply a.has-focus,
  300. .reply a:focus,
  301. .reply a:hover,
  302. .wp-block-button__link:focus,
  303. .wp-block-button__link:hover,
  304. .wp-block-file .has-focus.wp-block-file__button,
  305. .wp-block-file .wp-block-file__button:focus,
  306. .wp-block-file .wp-block-file__button:hover,
  307. button.has-focus,
  308. button:focus,
  309. button:hover,
  310. input.has-focus[type="submit"],
  311. input:focus[type="submit"],
  312. input:hover[type="submit"]', 'background-color', '-1' ),
  313. // Text Color
  314. array( '.wp-block-button.is-style-outline .wp-block-button__link.has-focus,
  315. .wp-block-button.is-style-outline .wp-block-button__link:focus,
  316. .wp-block-button.is-style-outline .wp-block-button__link:hover,
  317. .wp-block-button.is-style-outline.wp-block-button__link.has-focus,
  318. .wp-block-button.is-style-outline.wp-block-button__link:focus,
  319. .wp-block-button.is-style-outline.wp-block-button__link:hover', 'color', '-1' ),
  320. ), __( 'Secondary Color' ) );
  321. // Tertiary Color
  322. // --global--color-tertiary
  323. add_color_rule( 'fg2', '#FAFBF6', array(
  324. // Text-color
  325. array( '.wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-image-text,
  326. .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-text,
  327. .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover__inner-container,
  328. .wp-block-cover:not([class*="background-color"]) .wp-block-cover-image-text,
  329. .wp-block-cover:not([class*="background-color"]) .wp-block-cover-text,
  330. .wp-block-cover:not([class*="background-color"]) .wp-block-cover__inner-container', 'color' ),
  331. /**
  332. * Utility Classes
  333. */
  334. // Background-color
  335. array( '.has-tertiary-background-color[class],
  336. .has-background-light-background-color[class]', 'background-color' ),
  337. // Text-color
  338. array( '.has-tertiary-color[class],
  339. .has-background-light-color[class]', 'color' ),
  340. ), __( 'Tertiary Color' ) );
  341. /**
  342. * Custom CSS
  343. */
  344. function seedlet_custom_colors_extra_css() {
  345. $colors_array = get_theme_mod( 'colors_manager' );
  346. $color_bg = $colors_array['colors']['bg'];
  347. $color_fg1 = $colors_array['colors']['fg1'];
  348. $color_fg2 = $colors_array['colors']['fg2']; ?>
  349. /*
  350. * Revert back to a less custom treatment for the site title underline.
  351. */
  352. .site-title a {
  353. background-image: linear-gradient(to right, <?php echo $color_fg1; ?> 100%, transparent 100%);
  354. text-shadow: 1px 0px <?php echo $color_bg; ?>,
  355. -1px 0px <?php echo $color_bg; ?>,
  356. -2px 0px <?php echo $color_bg; ?>,
  357. 2px 0px <?php echo $color_bg; ?>,
  358. -3px 0px <?php echo $color_bg; ?>,
  359. 3px 0px <?php echo $color_bg; ?>,
  360. -4px 0px <?php echo $color_bg; ?>,
  361. 4px 0px <?php echo $color_bg; ?>,
  362. -5px 0px <?php echo $color_bg; ?>,
  363. 5px 0px <?php echo $color_bg; ?>;
  364. }
  365. /*
  366. * Custom gradients.
  367. */
  368. .has-hard-diagonal-gradient-background {
  369. background: linear-gradient(to bottom right, <?php echo $color_fg1; ?> 49.9%, <?php echo $color_fg2; ?> 50%);
  370. }
  371. .has-hard-diagonal-inverted-gradient-background {
  372. background: linear-gradient(to top left, <?php echo $color_fg1; ?> 49.9%, <?php echo $color_fg2; ?> 50%);
  373. }
  374. .has-diagonal-gradient-background {
  375. background: linear-gradient(to bottom right, <?php echo $color_fg1; ?>, <?php echo $color_fg2; ?>);
  376. }
  377. .has-diagonal-inverted-gradient-background {
  378. background: linear-gradient(to top left, <?php echo $color_fg1; ?>, <?php echo $color_fg2; ?>);
  379. }
  380. .has-hard-horizontal-gradient-background {
  381. background: linear-gradient(to bottom, <?php echo $color_fg1; ?> 50%, <?php echo $color_fg2; ?> 50%);
  382. }
  383. .has-hard-horizontal-inverted-gradient-background {
  384. background: linear-gradient(to top, <?php echo $color_fg1; ?> 50%, <?php echo $color_fg2; ?> 50%);
  385. }
  386. .has-horizontal-gradient-background {
  387. background: linear-gradient(to bottom, <?php echo $color_fg1; ?>, <?php echo $color_fg2; ?>);
  388. }
  389. .has-horizontal-inverted-gradient-background {
  390. background: linear-gradient(to top, <?php echo $color_fg1; ?>, <?php echo $color_fg2; ?>);
  391. }
  392. .has-stripe-gradient-background {
  393. background: linear-gradient(to bottom, transparent 20%, <?php echo $color_fg1; ?> 20%, <?php echo $color_fg1; ?> 80%, transparent 80%);
  394. }
  395. <?php }
  396. add_theme_support( 'custom_colors_extra_css', 'seedlet_custom_colors_extra_css' );
  397. /**
  398. * Featured Varia/Seedlet Palettes
  399. */
  400. // Light
  401. add_color_palette( array(
  402. '#FFFFFF',
  403. '#1D1E1E',
  404. '#C8133E',
  405. '#4E2F4B',
  406. ), 'Light' );
  407. // Medium
  408. add_color_palette( array(
  409. '#EEF4F7',
  410. '#242527',
  411. '#35845D',
  412. '#233252',
  413. ), 'Medium' );
  414. // Dark
  415. add_color_palette( array(
  416. '#1F2527',
  417. '#FFFFFF',
  418. '#9FD3E8',
  419. '#FBE6AA',
  420. '#364043',
  421. ), 'Dark' );