wpcom-editor-colors.php 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <?php
  2. /*
  3. * Custom Editor Colors: Varia
  4. */
  5. // Background Color (White)
  6. // $config-global--color-background-default
  7. add_editor_color_rule( 'bg', '#ffffff', array(
  8. // Background-color
  9. array( '#editor .editor-styles-wrapper,
  10. #editor .editor-styles-wrapper .fse-template-part .main-navigation > div > ul > li > .sub-menu', 'background-color' ),
  11. // Text-color
  12. array( '#editor .editor-styles-wrapper .button,
  13. #editor .editor-styles-wrapper .button.has-focus,
  14. #editor .editor-styles-wrapper .button:focus,
  15. #editor .editor-styles-wrapper .button:hover,
  16. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button,
  17. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button:focus,
  18. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button:hover,
  19. #editor .editor-styles-wrapper .fse-template-part .main-navigation .has-focus.button,
  20. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button,
  21. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:focus,
  22. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:hover,
  23. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .has-focus.button,
  24. #editor .editor-styles-wrapper table.is-style-stripes tbody tr:nth-child(odd),
  25. #editor .editor-styles-wrapper .wp-block-table.is-style-stripes tbody tr:nth-child(odd),
  26. #editor .editor-styles-wrapper .wp-block-button .wp-block-button__link,
  27. #editor .editor-styles-wrapper .wp-block-button .wp-block-button__link.has-focus,
  28. #editor .editor-styles-wrapper .wp-block-button .wp-block-button__link:focus,
  29. #editor .editor-styles-wrapper .wp-block-button .wp-block-button__link:hover,
  30. #editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color,
  31. #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-image-text,
  32. #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-text,
  33. #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover__inner-container,
  34. #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover-image-text,
  35. #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover-text,
  36. #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover__inner-container', 'color' ),
  37. /**
  38. * Utility Classes
  39. */
  40. // Text-color
  41. array( '#editor .editor-styles-wrapper .has-primary-background-color,
  42. #editor .editor-styles-wrapper .has-secondary-background-color,
  43. #editor .editor-styles-wrapper .has-foreground-background-color,
  44. #editor .editor-styles-wrapper .has-foreground-dark-background-color,
  45. #editor .editor-styles-wrapper .has-foreground-light-background-color,
  46. #editor .editor-styles-wrapper .has-background-color', 'color' ),
  47. // Background-color
  48. array( '#editor .editor-styles-wrapper .has-background-background-color[class]', 'background-color' ),
  49. // Text-color darkened
  50. array( '#editor .editor-styles-wrapper .has-background-dark-color[class]', 'color', '-1' ),
  51. // Background-color darkened
  52. array( '#editor .editor-styles-wrapper .has-background-dark-background-color[class]', 'background-color', '-1' ),
  53. // Text-color lightened
  54. array( '#editor .editor-styles-wrapper .has-background-light-color[class]', 'color', '+1' ),
  55. // Background-color lightened
  56. array( '#editor .editor-styles-wrapper .has-background-light-background-color[class]', 'background-color', '+1' ),
  57. /**
  58. * Clean up for nested items
  59. */
  60. // Text-color
  61. array( '#editor .editor-styles-wrapper .has-background:not(.has-background-background-color) .wp-block-quote .wp-block-quote__citation,
  62. #editor .editor-styles-wrapper [class*="background-color"]:not(.has-background-background-color) .wp-block-quote .wp-block-quote__citation,
  63. #editor .editor-styles-wrapper [style*="background-color"]:not(.has-background-background-color) .wp-block-quote .wp-block-quote__citation,
  64. #editor .editor-styles-wrapper .wp-block-cover[style*="background-image"] .wp-block-quote .wp-block-quote__citation', 'color' ),
  65. // Border-color
  66. array( '#editor .editor-styles-wrapper .has-background:not(.has-background-background-color) .wp-block-quote,
  67. #editor .editor-styles-wrapper [class*="background-color"]:not(.has-background-background-color) .wp-block-quote,
  68. #editor .editor-styles-wrapper [style*="background-color"]:not(.has-background-background-color) .wp-block-quote,
  69. #editor .editor-styles-wrapper .wp-block-cover[style*="background-image"] .wp-block-quote', 'border-color'),
  70. ), __( 'Background Color' ) );
  71. // Link Color (Blue)
  72. // $config-global--color-primary-default
  73. add_editor_color_rule( 'link', '#3E7D98', array(
  74. // Background-color
  75. array( '#editor .editor-styles-wrapper .button,
  76. #editor .editor-styles-wrapper .fse-template-part .main-navigation .button,
  77. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button,
  78. #editor .editor-styles-wrapper .wp-block-button:not(.is-style-outline) .wp-block-button__link:not(.has-background),
  79. #editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color', 'background-color' ),
  80. // Text-color
  81. array( '#editor .editor-styles-wrapper .is-style-outline .wp-block-button__link:not(.has-text-color),
  82. #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline:not(.has-text-color),
  83. #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a,
  84. #editor .editor-styles-wrapper .wp-block-separator.is-style-dots:before,
  85. #editor .editor-styles-wrapper a,
  86. #editor .editor-styles-wrapper hr.is-style-dots:before', 'color' ),
  87. // Border color top
  88. array( '#editor .editor-styles-wrapper .wp-block-pullquote', 'border-top-color' ),
  89. // Border color bottom
  90. array( '#editor .editor-styles-wrapper .wp-block-pullquote,
  91. #editor .editor-styles-wrapper .wp-block-separator,
  92. #editor .editor-styles-wrapper hr', 'border-bottom-color' ),
  93. // Border color left
  94. array( '#editor .editor-styles-wrapper .wp-block-quote', 'border-left-color' ),
  95. // Border color right
  96. array( '#editor .editor-styles-wrapper .wp-block-separator[style*="text-align: right"],
  97. #editor .editor-styles-wrapper .wp-block-separator[style*="text-align:right"],
  98. #editor .editor-styles-wrapper hr[style*="text-align: right"],
  99. #editor .editor-styles-wrapper hr[style*="text-align:right"]', 'border-right-color' ),
  100. /**
  101. * Utility Classes
  102. */
  103. // Background-color
  104. array( '#editor .editor-styles-wrapper .has-primary-background-color[class]', 'background-color' ),
  105. // Text-color
  106. array( '#editor .editor-styles-wrapper .has-primary-color[class]', 'color' ),
  107. ), __( 'Link Color' ) );
  108. // Text Color (Gray)
  109. // $config-global--color-foreground-default
  110. add_editor_color_rule( 'txt', '#394d55', array(
  111. // Text-color
  112. array( '#editor .editor-styles-wrapper,
  113. #editor .editor-styles-wrapper .editor-post-title__block .editor-post-title__input,
  114. #editor .editor-styles-wrapper .fse-template-part .main-navigation,
  115. #editor .editor-styles-wrapper .fse-template-part .main-navigation a,
  116. #editor .editor-styles-wrapper .fse-template-part .main-navigation a:link,
  117. #editor .editor-styles-wrapper .fse-template-part .main-navigation a:visited,
  118. #editor .editor-styles-wrapper .has-foreground-color[class],
  119. #editor .editor-styles-wrapper .wp-block-pullquote,
  120. #editor .editor-styles-wrapper .wp-block-quote .wp-block-quote__citation,
  121. #editor .editor-styles-wrapper .wp-block-pullquote:not(.is-style-solid-color) .wp-block-pullquote__citation,
  122. #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline:hover,
  123. #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline:focus,
  124. #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline.has-focus,
  125. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link:hover,
  126. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link:focus,
  127. #editor .editor-styles-wrapper .is-style-outline .wp-block-button__link.has-focus', 'color' ),
  128. // Background-color
  129. array( '#editor .editor-styles-wrapper table.is-style-stripes tbody tr:nth-child(odd),
  130. #editor .editor-styles-wrapper .wp-block-table.is-style-stripes tbody tr:nth-child(odd)', 'background-color' ),
  131. /**
  132. * Utility Classes
  133. */
  134. // Text-color
  135. array( '#editor .editor-styles-wrapper .has-background-background-color[class],
  136. #editor .editor-styles-wrapper .has-background-dark-background-color[class],
  137. #editor .editor-styles-wrapper .has-background-light-background-color[class],
  138. #editor .editor-styles-wrapper .has-foreground-color[class]', 'color' ),
  139. // Background-color
  140. array( '#editor .editor-styles-wrapper .has-foreground-background-color[class]', 'background-color' ),
  141. // Text-color darkened
  142. array( '#editor .editor-styles-wrapper .has-foreground-dark-color[class]', 'color', '-1' ),
  143. // Background-color darkened
  144. array( '#editor .editor-styles-wrapper .has-foreground-dark-background-color[class]', 'background-color', '-1' ),
  145. // Text-color brightened
  146. array( '#editor .editor-styles-wrapper .has-foreground-light-color[class]', 'color', '+2' ),
  147. // Background-color brightened
  148. array( '#editor .editor-styles-wrapper .has-foreground-light-background-color[class]', 'background-color', '+2' ),
  149. ), __( 'Text Color' ) );
  150. // Accent Color (Red)
  151. // $config-global--color-secondary-default
  152. add_editor_color_rule( 'fg1', '#9B6A36', array(
  153. /**
  154. * Utility Classes
  155. */
  156. // Text-color
  157. array( '#editor .editor-styles-wrapper .has-secondary-color[class]', 'color' ),
  158. // Background-color
  159. array( '#editor .editor-styles-wrapper .has-secondary-background-color[class]', 'background-color' ),
  160. ), __( 'Secondary Color' ) );