wpcom-colors.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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', 'color' ),
  257. // Background-color
  258. array( '.a8c-posts-list__view-all,
  259. .button,
  260. .has-secondary-background-color[class],
  261. .reply a,
  262. .sticky-post,
  263. .wp-block-button__link,
  264. .wp-block-file .wp-block-file__button,
  265. button,
  266. button[data-load-more-btn],
  267. input[type="submit"]', 'background-color' ),
  268. // Border-bottom-color
  269. array( 'a', 'border-bottom-color' ),
  270. // Border-left-color
  271. array( '.wp-block-pullquote.is-style-large,
  272. .wp-block-quote', 'border-left-color' ),
  273. // Border-right-color
  274. array( '.wp-block-quote.has-text-align-right', 'border-right-color' ),
  275. // Outline-color
  276. array( '*:focus', 'outline-color' ),
  277. // Background-image
  278. array( '.site-title a', 'Background-image' ),
  279. // Text-decoration-color
  280. array( '.site-title > a', 'text-decoration-color' ),
  281. /**
  282. * Utility Classes
  283. */
  284. // Background-color
  285. array( '.has-secondary-background-color[class]', 'background-color' ),
  286. // Text-color
  287. array( '.has-secondary-color[class],
  288. .has-white-background-color[class],', 'color' ),
  289. /**
  290. * Button Hover Colors
  291. */
  292. // Background Color
  293. array( '.a8c-posts-list__view-all:focus,
  294. .a8c-posts-list__view-all:hover,
  295. .button:focus,
  296. .button:hover,
  297. .has-focus.a8c-posts-list__view-all,
  298. .has-focus.button,
  299. .has-focus.wp-block-button__link,
  300. .reply a.has-focus,
  301. .reply a:focus,
  302. .reply a:hover,
  303. .wp-block-button__link:focus,
  304. .wp-block-button__link:hover,
  305. .wp-block-file .has-focus.wp-block-file__button,
  306. .wp-block-file .wp-block-file__button:focus,
  307. .wp-block-file .wp-block-file__button:hover,
  308. button.has-focus,
  309. button:focus,
  310. button:hover,
  311. input.has-focus[type="submit"],
  312. input:focus[type="submit"],
  313. input:hover[type="submit"]', 'background-color', '-1' ),
  314. // Text Color
  315. array( '.wp-block-button.is-style-outline .wp-block-button__link.has-focus,
  316. .wp-block-button.is-style-outline .wp-block-button__link:focus,
  317. .wp-block-button.is-style-outline .wp-block-button__link:hover,
  318. .wp-block-button.is-style-outline.wp-block-button__link.has-focus,
  319. .wp-block-button.is-style-outline.wp-block-button__link:focus,
  320. .wp-block-button.is-style-outline.wp-block-button__link:hover', 'color', '-1' ),
  321. ), __( 'Secondary Color' ) );
  322. // Tertiary Color
  323. // --global--color-tertiary
  324. add_color_rule( 'fg2', '#FAFBF6', array(
  325. // Text-color
  326. array( '.wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-image-text,
  327. .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-text,
  328. .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover__inner-container,
  329. .wp-block-cover:not([class*="background-color"]) .wp-block-cover-image-text,
  330. .wp-block-cover:not([class*="background-color"]) .wp-block-cover-text,
  331. .wp-block-cover:not([class*="background-color"]) .wp-block-cover__inner-container', 'color' ),
  332. /**
  333. * Utility Classes
  334. */
  335. // Background-color
  336. array( '.has-tertiary-background-color[class],
  337. .has-background-light-background-color[class]', 'background-color' ),
  338. // Text-color
  339. array( '.has-tertiary-color[class],
  340. .has-background-light-color[class]', 'color' ),
  341. /**
  342. * Border Colors
  343. * --global--color-border
  344. */
  345. // Border-color
  346. array( '.comment-meta .comment-author .avatar,
  347. .wp-block-code,
  348. .wp-block-search .wp-block-search__input,
  349. .wp-block-search .wp-block-search__input:focus,
  350. input[type="color"],
  351. input[type="color"]:focus,
  352. input[type="date"],
  353. input[type="date"]:focus,
  354. input[type="datetime"],
  355. input[type="datetime"]:focus,
  356. input[type="datetime-local"],
  357. input[type="datetime-local"]:focus,
  358. input[type="email"],
  359. input[type="email"]:focus,
  360. input[type="month"],
  361. input[type="month"]:focus,
  362. input[type="number"],
  363. input[type="number"]:focus,
  364. input[type="password"],
  365. input[type="password"]:focus,
  366. input[type="range"],
  367. input[type="range"]:focus,
  368. input[type="search"],
  369. input[type="search"]:focus,
  370. input[type="tel"],
  371. input[type="tel"]:focus,
  372. input[type="text"],
  373. input[type="text"]:focus,
  374. input[type="time"],
  375. input[type="time"]:focus,
  376. input[type="url"],
  377. input[type="url"]:focus,
  378. input[type="week"],
  379. input[type="week"]:focus,
  380. select,
  381. textarea,
  382. textarea:focus', 'border-color' ),
  383. // Border-bottom-color
  384. array( '.comment-list > li:not(first-child),
  385. hr,
  386. hr.wp-block-separator', 'border-bottom-color' ),
  387. // Border-top-color
  388. array( '.comment-list .children > li,
  389. .site-main > article > .entry-footer', 'border-top-color' ),
  390. // Color
  391. array( 'hr.wp-block-separator.is-style-dots:before', 'color' ),
  392. ), __( 'Tertiary Color' ) );
  393. /**
  394. * Custom CSS.
  395. * The plugin takes the body of this function and applies it in a style tag in the document head.
  396. */
  397. function seedlet_custom_colors_extra_css() {
  398. $colors_array = get_theme_mod( 'colors_manager' );
  399. $color_bg = $colors_array['colors']['bg'];
  400. $color_fg1 = $colors_array['colors']['fg1'];
  401. $color_fg2 = $colors_array['colors']['fg2']; ?>
  402. /*
  403. * Site title text shadow.
  404. */
  405. .site-title a {
  406. background-image: linear-gradient(to right, <?php echo $color_fg1; ?> 100%, transparent 100%);
  407. text-shadow: 1px 0px <?php echo $color_bg; ?>,
  408. -1px 0px <?php echo $color_bg; ?>,
  409. -2px 0px <?php echo $color_bg; ?>,
  410. 2px 0px <?php echo $color_bg; ?>,
  411. -3px 0px <?php echo $color_bg; ?>,
  412. 3px 0px <?php echo $color_bg; ?>,
  413. -4px 0px <?php echo $color_bg; ?>,
  414. 4px 0px <?php echo $color_bg; ?>,
  415. -5px 0px <?php echo $color_bg; ?>,
  416. 5px 0px <?php echo $color_bg; ?>;
  417. }
  418. /*
  419. * Custom gradients.
  420. */
  421. .has-hard-diagonal-gradient-background {
  422. background: linear-gradient(to bottom right, <?php echo $color_fg1; ?> 49.9%, <?php echo $color_fg2; ?> 50%);
  423. }
  424. .has-hard-diagonal-inverted-gradient-background {
  425. background: linear-gradient(to top left, <?php echo $color_fg1; ?> 49.9%, <?php echo $color_fg2; ?> 50%);
  426. }
  427. .has-diagonal-gradient-background {
  428. background: linear-gradient(to bottom right, <?php echo $color_fg1; ?>, <?php echo $color_fg2; ?>);
  429. }
  430. .has-diagonal-inverted-gradient-background {
  431. background: linear-gradient(to top left, <?php echo $color_fg1; ?>, <?php echo $color_fg2; ?>);
  432. }
  433. .has-hard-horizontal-gradient-background {
  434. background: linear-gradient(to bottom, <?php echo $color_fg1; ?> 50%, <?php echo $color_fg2; ?> 50%);
  435. }
  436. .has-hard-horizontal-inverted-gradient-background {
  437. background: linear-gradient(to top, <?php echo $color_fg1; ?> 50%, <?php echo $color_fg2; ?> 50%);
  438. }
  439. .has-horizontal-gradient-background {
  440. background: linear-gradient(to bottom, <?php echo $color_fg1; ?>, <?php echo $color_fg2; ?>);
  441. }
  442. .has-horizontal-inverted-gradient-background {
  443. background: linear-gradient(to top, <?php echo $color_fg1; ?>, <?php echo $color_fg2; ?>);
  444. }
  445. .has-stripe-gradient-background {
  446. background: linear-gradient(to bottom, transparent 20%, <?php echo $color_fg1; ?> 20%, <?php echo $color_fg1; ?> 80%, transparent 80%);
  447. }
  448. <?php }
  449. add_theme_support( 'custom_colors_extra_css', 'seedlet_custom_colors_extra_css' );
  450. /**
  451. * Featured Varia/Seedlet Palettes
  452. */
  453. // Light
  454. add_color_palette( array(
  455. '#FFFFFF',
  456. '#1D1E1E',
  457. '#C8133E',
  458. '#4E2F4B',
  459. '#F9F9F9',
  460. ), 'Light' );
  461. // Medium
  462. add_color_palette( array(
  463. '#EEF4F7',
  464. '#242527',
  465. '#35845D',
  466. '#233252',
  467. '#F9F9F9',
  468. ), 'Medium' );
  469. // Dark
  470. add_color_palette( array(
  471. '#1F2527',
  472. '#FFFFFF',
  473. '#9FD3E8',
  474. '#FBE6AA',
  475. '#364043',
  476. ), 'Dark' );