wpcom-editor-colors.php 9.9 KB

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