wpcom-colors.php 15 KB

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