wpcom-colors.php 17 KB

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