wpcom-colors.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <?php
  2. /*
  3. * Custom Colors: Varia
  4. */
  5. // Background Color (White)
  6. // $config-global--color-background-default
  7. add_color_rule( 'bg', '#ffffff', array(
  8. // Background-color
  9. array( '.screen-reader-text:focus,
  10. body,
  11. body .widget_eu_cookie_law_widget #eu-cookie-law,
  12. body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept,
  13. .main-navigation > div > ul > li > .sub-menu', 'background-color' ),
  14. // Text-color
  15. array( '.a8c-posts-list-item__featured span,
  16. .a8c-posts-list__view-all,
  17. .a8c-posts-list__view-all:focus,
  18. .a8c-posts-list__view-all:hover,
  19. .button,
  20. .button:focus,
  21. .button:hover,
  22. .has-focus.a8c-posts-list__view-all,
  23. .has-focus.button,
  24. .has-focus.wp-block-button__link,
  25. .has-focus.wp-block-file__button,
  26. .sticky-post,
  27. .wp-block-button__link,
  28. .wp-block-button__link:focus,
  29. .wp-block-button__link:hover,
  30. .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-image-text,
  31. .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-text,
  32. .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover__inner-container,
  33. .wp-block-cover:not([class*="background-color"]) .wp-block-cover-image-text,
  34. .wp-block-cover:not([class*="background-color"]) .wp-block-cover-text,
  35. .wp-block-cover:not([class*="background-color"]) .wp-block-cover__inner-container,
  36. .wp-block-file .wp-block-file__button,
  37. .wp-block-file a.wp-block-file__button:active,
  38. .wp-block-file a.wp-block-file__button:focus,
  39. .wp-block-file a.wp-block-file__button:hover,
  40. .wp-block-file a.wp-block-file__button:visited,
  41. .wp-block-file__button,
  42. .wp-block-file__button:focus,
  43. .wp-block-file__button:hover,
  44. .wp-block-gallery .blocks-gallery-image figcaption,
  45. .wp-block-gallery .blocks-gallery-item figcaption,
  46. .wp-block-pullquote.is-style-solid-color,
  47. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept,
  48. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:focus,
  49. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:hover,
  50. body .widget_eu_cookie_law_widget #eu-cookie-law input.has-focus.accept,
  51. body .widget_eu_cookie_law_widget #eu-cookie-law.negative,
  52. button,
  53. button.has-focus,
  54. button:focus,
  55. button:hover,
  56. button[data-load-more-btn],
  57. input.has-focus[type="submit"],
  58. input:focus[type="submit"],
  59. input:hover[type="submit"],
  60. input[type="submit"]', 'color' ),
  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. // Text-color lightened
  78. array( '.has-background-light-color[class]', 'color', '+1' ),
  79. // Background-color lightened
  80. array( '.has-background-light-background-color[class]', 'background-color', '+1' ),
  81. ), __( 'Background Color' ) );
  82. // Link Color (Blue)
  83. // $config-global--color-primary-default
  84. add_color_rule( 'link', '#0000ff', array(
  85. // Background-color
  86. array( '.a8c-posts-list-item__featured span,
  87. .a8c-posts-list__view-all,
  88. .button,
  89. .sticky-post,
  90. .wp-block-button__link,
  91. .wp-block-file .wp-block-file__button,
  92. .wp-block-file__button,
  93. .wp-block-pullquote.is-style-solid-color,
  94. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept,
  95. button,
  96. button[data-load-more-btn],
  97. input[type="submit"]', 'background-color' ),
  98. // Text-color
  99. array( '.main-navigation a,
  100. .main-navigation a:link,
  101. .main-navigation a:visited,
  102. .site-title,
  103. .social-navigation a,
  104. .wp-block-button.is-style-outline .wp-block-button__link,
  105. .wp-block-button.is-style-outline .wp-block-button__link:active,
  106. .wp-block-button.is-style-outline.wp-block-button__link,
  107. .wp-block-button.is-style-outline.wp-block-button__link:active,
  108. .wp-block-newspack-blocks-homepage-articles article .entry-title a,
  109. a', 'color' ),
  110. // Border color left
  111. array( '.wp-block-quote', 'border-left-color' ),
  112. // Border color right
  113. array( '.wp-block-quote[style*="text-align: right"],
  114. .wp-block-quote[style*="text-align:right"]', 'border-right-color' ),
  115. // Background-color with less opacity (dim)
  116. array( '.a8c-posts-list__view-all:focus,
  117. .a8c-posts-list__view-all:hover,
  118. .button:focus,
  119. .button:hover,
  120. .has-focus.a8c-posts-list__view-all,
  121. .has-focus.button,
  122. .has-focus.wp-block-button__link,
  123. .has-focus.wp-block-file__button,
  124. .main-navigation #toggle:focus + #toggle-menu,
  125. .wp-block-button__link:focus,
  126. .wp-block-button__link:hover,
  127. .wp-block-file__button:focus,
  128. .wp-block-file__button:hover,
  129. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:focus,
  130. body .widget_eu_cookie_law_widget #eu-cookie-law input.accept:hover,
  131. body .widget_eu_cookie_law_widget #eu-cookie-law input.has-focus.accept,
  132. button.has-focus,
  133. button:focus,
  134. button:hover,
  135. input.has-focus[type="submit"],
  136. input:focus[type="submit"],
  137. input:hover[type="submit"]', 'background-color', 0.8 ),
  138. // Text-color with less opacity (dim)
  139. array( '.a8c-posts-list__item .a8c-posts-list-item__meta a:active,
  140. .a8c-posts-list__item .a8c-posts-list-item__meta a:hover,
  141. .comment-meta .comment-metadata a:active,
  142. .comment-meta .comment-metadata a:hover,
  143. .entry-footer a:active,
  144. .entry-footer a:hover,
  145. .entry-meta a:active,
  146. .entry-meta a:hover,
  147. .footer-navigation .footer-menu a:hover,
  148. .main-navigation a:hover,
  149. .site-info a:hover,
  150. .site-title a:hover,
  151. .social-navigation a:hover,
  152. .wp-block-button.is-style-outline .wp-block-button__link.has-focus,
  153. .wp-block-button.is-style-outline .wp-block-button__link:focus,
  154. .wp-block-button.is-style-outline .wp-block-button__link:hover,
  155. .wp-block-button.is-style-outline.wp-block-button__link.has-focus,
  156. .wp-block-button.is-style-outline.wp-block-button__link:focus,
  157. .wp-block-button.is-style-outline.wp-block-button__link:hover,
  158. .wp-block-newspack-blocks-homepage-articles article .cat-links a:active,
  159. .wp-block-newspack-blocks-homepage-articles article .cat-links a:hover,
  160. .wp-block-newspack-blocks-homepage-articles article .entry-meta a:active,
  161. .wp-block-newspack-blocks-homepage-articles article .entry-meta a:hover,
  162. .wp-block-newspack-blocks-homepage-articles article .entry-title a:hover,
  163. a:hover', 'color', 0.8 ),
  164. // Border-color (forms)
  165. // Needs contrast against `bg` with less contrast
  166. array( 'input[type="color"]:focus,
  167. input[type="date"]:focus,
  168. input[type="datetime"]:focus,
  169. input[type="datetime-local"]:focus,
  170. input[type="email"]:focus,
  171. input[type="month"]:focus,
  172. input[type="number"]:focus,
  173. input[type="password"]:focus,
  174. input[type="range"]:focus,
  175. input[type="search"]:focus,
  176. input[type="tel"]:focus,
  177. input[type="text"]:focus,
  178. input[type="time"]:focus,
  179. input[type="url"]:focus,
  180. input[type="week"]:focus,
  181. textarea:focus', 'border-color' ),
  182. /**
  183. * Utility Classes
  184. */
  185. // Background-color
  186. array( '.has-primary-background-color[class]', 'background-color' ),
  187. // Text-color
  188. array( '.has-primary-color[class]', 'color' ),
  189. ), __( 'Link Color' ) );
  190. // Text Color (Gray)
  191. // $config-global--color-foreground-default
  192. add_color_rule( 'txt', '#444444', array(
  193. // Text-color
  194. array( '.comment-meta .comment-metadata,
  195. .main-navigation,
  196. .screen-reader-text:focus,
  197. .site-branding,
  198. .wp-block-code,
  199. .wp-block-code pre,
  200. .wp-block-pullquote,
  201. body,
  202. body .widget_eu_cookie_law_widget #eu-cookie-law,
  203. hr.wp-block-separator.is-style-dots:before', 'color' ),
  204. // Text-color (forms)
  205. // Needs contrast against form background-color (which is always white)
  206. array( 'body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept,
  207. input[type="color"],
  208. input[type="color"]:focus,
  209. input[type="date"],
  210. input[type="date"]:focus,
  211. input[type="datetime"],
  212. input[type="datetime"]:focus,
  213. input[type="datetime-local"],
  214. input[type="datetime-local"]:focus,
  215. input[type="email"],
  216. input[type="email"]:focus,
  217. input[type="month"],
  218. input[type="month"]:focus,
  219. input[type="number"],
  220. input[type="number"]:focus,
  221. input[type="password"],
  222. input[type="password"]:focus,
  223. input[type="range"],
  224. input[type="range"]:focus,
  225. input[type="search"],
  226. input[type="search"]:focus,
  227. input[type="tel"],
  228. input[type="tel"]:focus,
  229. input[type="text"],
  230. input[type="text"]:focus,
  231. input[type="time"],
  232. input[type="time"]:focus,
  233. input[type="url"],
  234. input[type="url"]:focus,
  235. input[type="week"],
  236. input[type="week"]:focus,
  237. textarea,
  238. textarea:focus', 'color', '#ffffff', 8 ),
  239. // Text-color with less opacity (dim)
  240. array( '.a8c-posts-list__item .a8c-posts-list-item__meta,
  241. .entry-footer,
  242. .entry-meta,
  243. .footer-navigation .footer-menu,
  244. .site-info,
  245. .wp-block-image figcaption,
  246. .wp-block-latest-comments .wp-block-latest-comments__comment-date,
  247. .wp-block-latest-posts .wp-block-latest-posts__post-date,
  248. .wp-block-newspack-blocks-homepage-articles article .cat-links,
  249. .wp-block-newspack-blocks-homepage-articles article .entry-meta,
  250. .wp-block-pullquote .wp-block-pullquote__citation,
  251. .wp-block-pullquote cite,
  252. .wp-block-pullquote footer,
  253. .wp-block-quote .wp-block-quote__citation,
  254. .wp-block-quote cite,
  255. .wp-block-quote footer,
  256. .wp-block-quote.is-large .wp-block-quote__citation,
  257. .wp-block-quote.is-large cite,
  258. .wp-block-quote.is-large footer,
  259. .wp-block-quote.is-style-large .wp-block-quote__citation,
  260. .wp-block-quote.is-style-large cite,
  261. .wp-block-quote.is-style-large footer,
  262. .wp-block-video figcaption,
  263. figcaption', 'color', 0.8 ),
  264. // Border-color with less opacity (dim)
  265. array( '.wp-block-code,
  266. body .widget_eu_cookie_law_widget #eu-cookie-law,
  267. input[type="color"],
  268. input[type="date"],
  269. input[type="datetime"],
  270. input[type="datetime-local"],
  271. input[type="email"],
  272. input[type="month"],
  273. input[type="number"],
  274. input[type="password"],
  275. input[type="range"],
  276. input[type="search"],
  277. input[type="tel"],
  278. input[type="text"],
  279. input[type="time"],
  280. input[type="url"],
  281. input[type="week"],
  282. select,
  283. textarea', 'border-color', 0.8 ),
  284. // Border-top-color with less opacity (dim)
  285. array( '.comment-list .children > li,
  286. .comment-list > li,
  287. .wp-block-pullquote', 'border-top-color', 0.8 ),
  288. // Border-bottom-color with less opacity (dim)
  289. array( '.comment-list,
  290. .wp-block-pullquote,
  291. hr,
  292. hr.wp-block-separator', 'border-bottom-color', 0.8 ),
  293. // Background-color
  294. array( 'body .widget_eu_cookie_law_widget #eu-cookie-law.negative', 'background-color' ),
  295. // Background-color
  296. array( 'body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept.has-focus,
  297. body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept:focus,
  298. body .widget_eu_cookie_law_widget #eu-cookie-law.negative input.accept:hover', 'background-color', 0.8 ),
  299. /**
  300. * Utility Classes
  301. */
  302. // Foreground
  303. array( '.has-foreground-color[class],
  304. .has-background-background-color[class],
  305. .has-background-dark-background-color[class],
  306. .has-background-light-background-color[class]', 'color' ),
  307. // Background
  308. array( '.has-foreground-background-color[class]', 'background-color' ),
  309. // Text-color darkened
  310. array( '.has-foreground-dark-color[class]', 'color', '-1' ),
  311. // Background-color darkened
  312. array( '.has-foreground-dark-background-color[class]', 'background-color', '-1' ),
  313. // Text-color brightened
  314. array( '.has-foreground-light-color[class]', 'color', '+2' ),
  315. // Background-color brightened
  316. array( '.has-foreground-light-background-color[class]', 'background-color', '+2' ),
  317. ), __( 'Text Color' ) );
  318. // Accent Color (Red)
  319. // $config-global--color-secondary-default
  320. add_color_rule( 'fg1', '#ff0000', array(
  321. /**
  322. * Utility Classes
  323. */
  324. // Text-color
  325. array( '.has-secondary-color[class]', 'color' ),
  326. // Background-color
  327. array( '.has-secondary-background-color[class]', 'background-color' ),
  328. ), __( 'Secondary Color' ) );