wpcom-colors.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  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( '.wp-block-pullquote.is-style-solid-color,
  140. .wp-block-cover-image.has-background-dim,
  141. .wp-block-cover.has-background-dim', 'background-color' ),
  142. // Border-bottom-color
  143. array( '.pagination .nav-links > *.current', 'border-bottom-color' ),
  144. /**
  145. * Utility Classes
  146. */
  147. // Foreground
  148. array( '.has-foreground-color[class],
  149. .has-background-background-color[class],
  150. .has-background-dark-background-color[class],
  151. .has-background-light-background-color[class]', 'color' ),
  152. // Background
  153. array( '.has-foreground-background-color[class]', 'background-color' ),
  154. // Text-color darkened
  155. array( '.has-foreground-dark-color[class]', 'color', '-1' ),
  156. // Background-color darkened
  157. array( '.has-foreground-dark-background-color[class]', 'background-color', '-1' ),
  158. // Text-color brightened
  159. array( '.has-foreground-light-color[class]', 'color', '+2' ),
  160. // Background-color brightened
  161. array( '.has-foreground-light-background-color[class]', 'background-color', '+2' ),
  162. ), __( 'Foreground Color' ) );
  163. // Primary Color
  164. // --global--color-primary
  165. add_color_rule( 'link', '#000000', array(
  166. // Text-color
  167. array( '.entry-title,
  168. .navigation a,
  169. .navigation a:active,
  170. .primary-navigation .menu-item > a,
  171. .primary-navigation .menu-item > a:active,
  172. .primary-navigation > .button,
  173. .site-footer > .site-info a:focus,
  174. .site-footer > .site-info a:hover,
  175. .site-title,
  176. .woo-navigation .menu-item > a,
  177. .woo-navigation .menu-item > a:active,
  178. .woo-navigation > .button,
  179. .wp-block-a8c-blog-posts article .entry-title a,
  180. .wp-block-a8c-blog-posts article .entry-title a:active,
  181. .wp-block-newspack-blocks-homepage-articles article .entry-title a,
  182. .wp-block-newspack-blocks-homepage-articles article .entry-title a:active,
  183. a,
  184. a:active', 'color' ),
  185. // Background-color
  186. array( '.a8c-posts-list-item__featured span,
  187. .a8c-posts-list__view-all:active,
  188. .button:active,
  189. .wp-block-button__link:active,
  190. .wp-block-cover,
  191. .wp-block-cover-image,
  192. .wp-block-file .wp-block-file__button:active,
  193. button:active,
  194. input:active[type="submit"]', 'background-color' ),
  195. /**
  196. * Utility Classes
  197. */
  198. // Background-color
  199. array( '.has-primary-background-color[class]', 'background-color' ),
  200. // Text-color
  201. array( '.has-black-background-color[class],
  202. .has-primary-color[class]', 'color' ),
  203. ), __( 'Primary Color' ) );
  204. // Secondary Color
  205. // --global--color-secondary
  206. add_color_rule( 'fg1', '#3C8067', array(
  207. // Text-color
  208. array( '.a8c-posts-list__item .a8c-posts-list-item__meta a:active,
  209. .a8c-posts-list__item .a8c-posts-list-item__meta a:hover,
  210. .comment-meta .comment-metadata a:focus,
  211. .comment-meta .comment-metadata a:hover,
  212. .entry-footer a:focus,
  213. .entry-footer a:hover,
  214. .entry-meta a:focus,
  215. .entry-meta a:hover,
  216. .entry-title a:focus,
  217. .entry-title a:hover,
  218. .navigation a:focus,
  219. .navigation a:hover,
  220. .pagination .nav-links > a:hover,
  221. .site-footer > .footer-navigation .footer-menu a:focus,
  222. .site-footer > .footer-navigation .footer-menu a:hover,
  223. .site-title a:focus,
  224. .site-title a:hover,
  225. .social-navigation a:focus,
  226. .social-navigation a:hover,
  227. .woo-navigation .menu-item > a:focus,
  228. .woo-navigation .menu-item > a:hover,
  229. .woo-navigation .primary-menu > .menu-item:hover > a,
  230. .woo-navigation > .button:hover,
  231. .wp-block-a8c-blog-posts article .cat-links a:active,
  232. .wp-block-a8c-blog-posts article .cat-links a:hover,
  233. .wp-block-a8c-blog-posts article .entry-meta a:active,
  234. .wp-block-a8c-blog-posts article .entry-meta a:hover,
  235. .wp-block-a8c-blog-posts article .entry-title a:focus,
  236. .wp-block-a8c-blog-posts article .entry-title a:hover,
  237. .wp-block-button.is-style-outline .wp-block-button__link,
  238. .wp-block-button.is-style-outline .wp-block-button__link:active,
  239. .wp-block-button.is-style-outline.wp-block-button__link,
  240. .wp-block-button.is-style-outline.wp-block-button__link:active,
  241. .wp-block-navigation:not(.has-text-color) .wp-block-navigation-link > a:focus,
  242. .wp-block-navigation:not(.has-text-color) .wp-block-navigation-link > a: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:focus,
  248. .wp-block-newspack-blocks-homepage-articles article .entry-title a:hover,
  249. .primary-navigation .menu-item > a:focus,
  250. .primary-navigation .menu-item > a:hover,
  251. .primary-navigation .primary-menu > .menu-item:hover > a,
  252. .primary-navigation > .button:hover,
  253. a:focus,
  254. a:hover', 'color' ),
  255. // Background-color
  256. array( '.a8c-posts-list__view-all,
  257. .button,
  258. .has-secondary-background-color[class],
  259. .reply a,
  260. .sticky-post,
  261. .wp-block-button__link,
  262. .wp-block-file .wp-block-file__button,
  263. button,
  264. button[data-load-more-btn],
  265. input[type="submit"]', 'background-color' ),
  266. // Border-bottom-color
  267. array( 'a', 'border-bottom-color' ),
  268. // Border-left-color
  269. array( '.wp-block-pullquote.is-style-large,
  270. .wp-block-quote', 'border-left-color' ),
  271. // Border-right-color
  272. array( '.wp-block-quote.has-text-align-right', 'border-right-color' ),
  273. // Outline-color
  274. array( '*:focus', 'outline-color' ),
  275. // Background-image
  276. array( '.site-title a', 'Background-image' ),
  277. // Text-decoration-color
  278. array( '.site-title > a', 'text-decoration-color' ),
  279. /**
  280. * Utility Classes
  281. */
  282. // Background-color
  283. array( '.has-secondary-background-color[class]', 'background-color' ),
  284. // Text-color
  285. array( '.has-secondary-color[class],
  286. .has-white-background-color[class],', 'color' ),
  287. /**
  288. * Button Hover Colors
  289. */
  290. // Background Color
  291. array( '.a8c-posts-list__view-all:focus,
  292. .a8c-posts-list__view-all:hover,
  293. .button:focus,
  294. .button:hover,
  295. .has-focus.a8c-posts-list__view-all,
  296. .has-focus.button,
  297. .has-focus.wp-block-button__link,
  298. .reply a.has-focus,
  299. .reply a:focus,
  300. .reply a:hover,
  301. .wp-block-button__link:focus,
  302. .wp-block-button__link:hover,
  303. .wp-block-file .has-focus.wp-block-file__button,
  304. .wp-block-file .wp-block-file__button:focus,
  305. .wp-block-file .wp-block-file__button:hover,
  306. button.has-focus,
  307. button:focus,
  308. button:hover,
  309. input.has-focus[type="submit"],
  310. input:focus[type="submit"],
  311. input:hover[type="submit"]', 'background-color', '-1' ),
  312. // Text Color
  313. array( '.wp-block-button.is-style-outline .wp-block-button__link.has-focus,
  314. .wp-block-button.is-style-outline .wp-block-button__link:focus,
  315. .wp-block-button.is-style-outline .wp-block-button__link:hover,
  316. .wp-block-button.is-style-outline.wp-block-button__link.has-focus,
  317. .wp-block-button.is-style-outline.wp-block-button__link:focus,
  318. .wp-block-button.is-style-outline.wp-block-button__link:hover', 'color', '-1' ),
  319. ), __( 'Secondary Color' ) );
  320. // Tertiary Color
  321. // --global--color-tertiary
  322. add_color_rule( 'fg2', '#FAFBF6', array(
  323. // Text-color
  324. array( '.wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-image-text,
  325. .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-text,
  326. .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover__inner-container,
  327. .wp-block-cover:not([class*="background-color"]) .wp-block-cover-image-text,
  328. .wp-block-cover:not([class*="background-color"]) .wp-block-cover-text,
  329. .wp-block-cover:not([class*="background-color"]) .wp-block-cover__inner-container', 'color' ),
  330. /**
  331. * Utility Classes
  332. */
  333. // Background-color
  334. array( '.has-tertiary-background-color[class],
  335. .has-background-light-background-color[class]', 'background-color' ),
  336. // Text-color
  337. array( '.has-tertiary-color[class],
  338. .has-background-light-color[class]', 'color' ),
  339. /**
  340. * Border Colors
  341. * --global--color-border
  342. */
  343. // Border-color
  344. array( '.comment-meta .comment-author .avatar,
  345. .wp-block-code,
  346. .wp-block-search .wp-block-search__input,
  347. .wp-block-search .wp-block-search__input:focus,
  348. input[type="color"],
  349. input[type="color"]:focus,
  350. input[type="date"],
  351. input[type="date"]:focus,
  352. input[type="datetime"],
  353. input[type="datetime"]:focus,
  354. input[type="datetime-local"],
  355. input[type="datetime-local"]:focus,
  356. input[type="email"],
  357. input[type="email"]:focus,
  358. input[type="month"],
  359. input[type="month"]:focus,
  360. input[type="number"],
  361. input[type="number"]:focus,
  362. input[type="password"],
  363. input[type="password"]:focus,
  364. input[type="range"],
  365. input[type="range"]:focus,
  366. input[type="search"],
  367. input[type="search"]:focus,
  368. input[type="tel"],
  369. input[type="tel"]:focus,
  370. input[type="text"],
  371. input[type="text"]:focus,
  372. input[type="time"],
  373. input[type="time"]:focus,
  374. input[type="url"],
  375. input[type="url"]:focus,
  376. input[type="week"],
  377. input[type="week"]:focus,
  378. select,
  379. textarea,
  380. textarea:focus', 'border-color' ),
  381. // Border-bottom-color
  382. array( '.comment-list > li:not(first-child),
  383. hr,
  384. hr.wp-block-separator', 'border-bottom-color' ),
  385. // Border-top-color
  386. array( '.comment-list .children > li,
  387. .site-main > article > .entry-footer', 'border-top-color' ),
  388. // Color
  389. array( 'hr.wp-block-separator.is-style-dots:before', 'color' ),
  390. ), __( 'Tertiary Color' ) );
  391. /**
  392. * Custom CSS
  393. */
  394. function seedlet_custom_colors_extra_css() {
  395. $colors_array = get_theme_mod( 'colors_manager' );
  396. $color_bg = $colors_array['colors']['bg'];
  397. $color_fg1 = $colors_array['colors']['fg1'];
  398. $color_fg2 = $colors_array['colors']['fg2']; ?>
  399. /*
  400. * Revert back to a less custom treatment for the site title underline.
  401. */
  402. .site-title a {
  403. background-image: linear-gradient(to right, <?php echo $color_fg1; ?> 100%, transparent 100%);
  404. text-shadow: 1px 0px <?php echo $color_bg; ?>,
  405. -1px 0px <?php echo $color_bg; ?>,
  406. -2px 0px <?php echo $color_bg; ?>,
  407. 2px 0px <?php echo $color_bg; ?>,
  408. -3px 0px <?php echo $color_bg; ?>,
  409. 3px 0px <?php echo $color_bg; ?>,
  410. -4px 0px <?php echo $color_bg; ?>,
  411. 4px 0px <?php echo $color_bg; ?>,
  412. -5px 0px <?php echo $color_bg; ?>,
  413. 5px 0px <?php echo $color_bg; ?>;
  414. }
  415. /*
  416. * Custom gradients.
  417. */
  418. .has-hard-diagonal-gradient-background {
  419. background: linear-gradient(to bottom right, <?php echo $color_fg1; ?> 49.9%, <?php echo $color_fg2; ?> 50%);
  420. }
  421. .has-hard-diagonal-inverted-gradient-background {
  422. background: linear-gradient(to top left, <?php echo $color_fg1; ?> 49.9%, <?php echo $color_fg2; ?> 50%);
  423. }
  424. .has-diagonal-gradient-background {
  425. background: linear-gradient(to bottom right, <?php echo $color_fg1; ?>, <?php echo $color_fg2; ?>);
  426. }
  427. .has-diagonal-inverted-gradient-background {
  428. background: linear-gradient(to top left, <?php echo $color_fg1; ?>, <?php echo $color_fg2; ?>);
  429. }
  430. .has-hard-horizontal-gradient-background {
  431. background: linear-gradient(to bottom, <?php echo $color_fg1; ?> 50%, <?php echo $color_fg2; ?> 50%);
  432. }
  433. .has-hard-horizontal-inverted-gradient-background {
  434. background: linear-gradient(to top, <?php echo $color_fg1; ?> 50%, <?php echo $color_fg2; ?> 50%);
  435. }
  436. .has-horizontal-gradient-background {
  437. background: linear-gradient(to bottom, <?php echo $color_fg1; ?>, <?php echo $color_fg2; ?>);
  438. }
  439. .has-horizontal-inverted-gradient-background {
  440. background: linear-gradient(to top, <?php echo $color_fg1; ?>, <?php echo $color_fg2; ?>);
  441. }
  442. .has-stripe-gradient-background {
  443. background: linear-gradient(to bottom, transparent 20%, <?php echo $color_fg1; ?> 20%, <?php echo $color_fg1; ?> 80%, transparent 80%);
  444. }
  445. <?php }
  446. add_theme_support( 'custom_colors_extra_css', 'seedlet_custom_colors_extra_css' );
  447. /**
  448. * Featured Varia/Seedlet Palettes
  449. */
  450. // Light
  451. add_color_palette( array(
  452. '#FFFFFF',
  453. '#1D1E1E',
  454. '#C8133E',
  455. '#4E2F4B',
  456. '#F9F9F9',
  457. ), 'Light' );
  458. // Medium
  459. add_color_palette( array(
  460. '#EEF4F7',
  461. '#242527',
  462. '#35845D',
  463. '#233252',
  464. '#F9F9F9',
  465. ), 'Medium' );
  466. // Dark
  467. add_color_palette( array(
  468. '#1F2527',
  469. '#FFFFFF',
  470. '#9FD3E8',
  471. '#FBE6AA',
  472. '#364043',
  473. ), 'Dark' );