wpcom-colors.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <?php
  2. /* Custom Colors: Affinity */
  3. //Background
  4. add_color_rule( 'bg', '#ffffff', array(
  5. array( 'body, .main-navigation.toggled > div', 'background-color' ),
  6. ) );
  7. add_color_rule( 'txt', '#5e5853', array(
  8. //Contrast with background bg
  9. array( '.entry-title, .entry-title a, .entry-title a:visited', 'color', 'bg' ),
  10. array( 'h1, h2, h3, h4, h5, h6', 'color', 'bg' ),
  11. array( '.widget-title', 'color', 'bg' ),
  12. array( '.comment-author .fn a, .comment-author .fn a:visited', 'color', 'bg' ),
  13. array( '.affinity-front-page .no-featured-image .entry-title', 'color', 'bg' ),
  14. //Contrast with white background
  15. array( '.main-navigation ul ul a, .main-navigation ul ul a:visited', 'color', '#fff' ),
  16. //No contrast
  17. array( '.button:hover, .button:active, .button:focus, button:hover, #infinite-handle span:hover, button:active, #infinite-handle span:active, button:focus, #infinite-handle span:focus, input[type="button"]:hover, input[type="button"]:active, input[type="button"]:focus, input[type="reset"]:hover, input[type="reset"]:active, input[type="reset"]:focus, input[type="submit"]:hover, input[type="submit"]:active, input[type="submit"]:focus', 'background-color' ),
  18. array( '.button:hover, .button:active, .button:focus, button:hover, #infinite-handle span:hover, button:active, #infinite-handle span:active, button:focus, #infinite-handle span:focus, input[type="button"]:hover, input[type="button"]:active, input[type="button"]:focus, input[type="reset"]:hover, input[type="reset"]:active, input[type="reset"]:focus, input[type="submit"]:hover, input[type="submit"]:active, input[type="submit"]:focus', 'outline-color' ),
  19. array( '.button:hover, .button:focus, .button:active', 'outline-color' ),
  20. ),
  21. __( 'Headings' ) );
  22. add_color_rule( 'link', '#99908a', array(
  23. //Contrast with background bg
  24. array( 'a, a:visited', 'color', 'bg' ),
  25. array( '.post-navigation .title', 'color', 'bg' ),
  26. array( '.site-footer', 'color', 'bg' ),
  27. array( 'blockquote', 'color', 'bg' ),
  28. array( '.comment-navigation a:hover, .comment-navigation a:visited:hover, .posts-navigation a:hover, .posts-navigation a:visited:hover, .post-navigation a:hover, .post-navigation a:visited:hover', 'color', 'bg' ),
  29. array( '.site-description a, .site-description a:visited', 'color', 'bg' ),
  30. //Contrast with white background
  31. array( '.main-navigation ul ul a:hover, .main-navigation ul ul a.focus', 'color', '#fff' ),
  32. array( '.main-navigation ul ul li:hover > a:visited, .main-navigation ul ul li.focus > a:visited', 'color', '#fff' ),
  33. //Contrast with darker footer bg
  34. array( '.footer-widgets a, .footer-widgets a:visited', 'color', '#000' ),
  35. //No contrast
  36. array( '.button, button, #infinite-handle span, input[type="button"], input[type="reset"], input[type="submit"]', 'outline-color' ),
  37. array( '.button, button, #infinite-handle span, input[type="button"], input[type="reset"], input[type="submit"]', 'background-color' ),
  38. array( 'input[type="text"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="number"]:focus, input[type="tel"]:focus, input[type="range"]:focus, input[type="date"]:focus, input[type="month"]:focus, input[type="week"]:focus, input[type="time"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="color"]:focus, textarea:focus', 'border-color' ),
  39. ),
  40. __( 'Links' ) );
  41. //Unused
  42. add_color_rule( 'fg1', '#ffffff', array(
  43. ) );
  44. add_color_rule( 'fg2', '#ffffff', array(
  45. ) );
  46. //Extra rules
  47. add_color_rule( 'extra', '#ffffff', array(
  48. //Contrast with txt
  49. array( '.button:hover, .button:active, .button:focus, button:hover, #infinite-handle span:hover, button:active, #infinite-handle span:active, button:focus, #infinite-handle span:focus, input[type="button"]:hover, input[type="button"]:active, input[type="button"]:focus, input[type="reset"]:hover, input[type="reset"]:active, input[type="reset"]:focus, input[type="submit"]:hover, input[type="submit"]:active, input[type="submit"]:focus', 'color', 'txt' ),
  50. array( '.button:hover, .button:active, .button:focus, button:hover, #infinite-handle span:hover, button:active, #infinite-handle span:active, button:focus, #infinite-handle span:focus, input[type="button"]:hover, input[type="button"]:active, input[type="button"]:focus, input[type="reset"]:hover, input[type="reset"]:active, input[type="reset"]:focus, input[type="submit"]:hover, input[type="submit"]:active, input[type="submit"]:focus', 'border-color', 'txt' ),
  51. array( '#infinite-handle span button:hover, #infinite-handle span button:focus, #infinite-handle span button:active', 'color', 'txt' ),
  52. array( '#infinite-handle span:hover button, #infinite-handle span:focus button, #infinite-handle span:active button', 'color', 'txt' ),
  53. //Contrast with link
  54. array( '.button, button, #infinite-handle span, #infinite-handle span button, input[type="button"], input[type="reset"], input[type="submit"]', 'color', 'link' ),
  55. array( '.button, button, #infinite-handle span, input[type="button"], input[type="reset"], input[type="submit"]', 'border-color', 'link' ),
  56. //Contrast with dark background
  57. array( '.menu-toggle', 'color', '#000' ),
  58. ) );
  59. //Main text color
  60. add_color_rule( 'extra', '#5e5853', array(
  61. array( 'body, button, #infinite-handle span, input, select, textarea', 'color', 'bg' ),
  62. // Input nackgrounds to not background color.
  63. array( 'label', 'color', '#ffffff' ),
  64. array( '.site-footer .sep', 'color', 'bg' ),
  65. array( '.page-links', 'color', 'bg' ),
  66. ) );
  67. //Link hovers
  68. add_color_rule( 'extra', '#383e44', array(
  69. array( 'a:hover, a:focus, a:active', 'color', 'bg' ),
  70. array( '.entry-meta a:hover, .entry-meta a:focus, .entry-meta a:active', 'color', 'bg' ),
  71. array( '.entry-meta', 'color', 'bg' ),
  72. array( '.entry-footer', 'color', 'bg' ),
  73. array( '.comment-navigation a, .comment-navigation a:visited, .posts-navigation a, .posts-navigation a:visited, .post-navigation a, .post-navigation a:visited', 'color', 'bg' ),
  74. ) );
  75. //Borders
  76. add_color_rule( 'extra', '#e8e9ea', array(
  77. array( '.comment-navigation, .posts-navigation, .post-navigation', 'border-color', 0.4 ),
  78. array( '.entry-meta', 'border-color', 0.5 ),
  79. array( '#secondary .widget', 'border-color', 0.4 ),
  80. array( '.widget-title', 'border-color', 0.4 ),
  81. array( '.widget div > ul li, .widget > ul li', 'border-color', 0.5 ),
  82. array( '.hentry', 'border-color', 0.5 ),
  83. array( '.page-links', 'border-color', 0.4 ),
  84. array( 'td, th', 'border-color', 0.5 ),
  85. array( '.page-header', 'border-color', 0.5 ),
  86. array( 'blockquote', 'border-color', 0.5 ),
  87. array( '.comment-body', 'border-color', 0.5 ),
  88. array( '.entry-meta, .comment-meta', 'border-color', 0.5 ),
  89. array( 'input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="search"], input[type="number"], input[type="tel"], input[type="range"], input[type="date"], input[type="month"], input[type="week"], input[type="time"], input[type="datetime"], input[type="datetime-local"], input[type="color"], textarea', 'border-color', 0.4 ),
  90. //Contrast with dark footer widgets background
  91. array( '.footer-widgets .widget-title', 'color', '#000' ),
  92. array( '.footer-widgets', 'color', '#000' ),
  93. array( '.site-title a, .site-title a:visited', 'color', '#000' ),
  94. ) );
  95. //Extra CSS
  96. function affinity_extra_css() { ?>
  97. @media screen and ( min-width: 46em ) {
  98. .site-description a,
  99. .site-description a:visited {
  100. color: white !important;
  101. }
  102. .main-navigation.toggled > div {
  103. background: transparent !important;
  104. }
  105. }
  106. <?php }
  107. add_theme_support( 'custom_colors_extra_css', 'affinity_extra_css' );
  108. //Additional palettes
  109. add_color_palette( array(
  110. '#f7f7f7',
  111. '#2d3838',
  112. '#357c7c',
  113. ), 'Blue' );
  114. add_color_palette( array(
  115. '#474747',
  116. '#eaeaea',
  117. '#cbe86b',
  118. ), 'Dark Lime' );
  119. add_color_palette( array(
  120. '#f5eee9',
  121. '#a39c8e',
  122. '#44749d',
  123. ), 'Vintage Blue' );
  124. add_color_palette( array(
  125. '#f4f2f0',
  126. '#4a6e90',
  127. '#ac4a00',
  128. ), 'Vintage Red' );
  129. add_color_palette( array(
  130. '#f2f2f2',
  131. '#727272',
  132. '#bb512a',
  133. ), 'Orange' );
  134. add_color_palette( array(
  135. '#3f3f3f',
  136. '#d8d8d8',
  137. '#dad88a',
  138. ), 'Dark Yellow' );