123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371 |
- <?php
- /*
- * Custom Editor Colors
- */
- // Background Color
- // $config-global--color-background-default
- add_editor_color_rule(
- 'bg',
- '#FFFFFF',
- array(
- // Background-color
- array( '#editor .editor-styles-wrapper', 'background-color' ),
- // Text-color
- array(
- '#editor .editor-styles-wrapper .button,
- #editor .editor-styles-wrapper .button.has-focus,
- #editor .editor-styles-wrapper .button:focus,
- #editor .editor-styles-wrapper .button:hover,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:focus,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:hover,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .has-focus.button,
- #editor .editor-styles-wrapper .wp-block-button__link,
- #editor .editor-styles-wrapper .wp-block-button__link.has-focus,
- #editor .editor-styles-wrapper .wp-block-button__link:focus,
- #editor .editor-styles-wrapper .wp-block-button__link:hover,
- #editor .editor-styles-wrapper .wp-block-cover-image,
- #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .block-editor-block-list__block,
- #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-image-text,
- #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover-text,
- #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .wp-block-cover__inner-container,
- #editor .editor-styles-wrapper .wp-block-cover-image:not([class*="background-color"]) .block-editor-block-list__block,
- #editor .editor-styles-wrapper .wp-block-cover,
- #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .block-editor-block-list__block,
- #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover-image-text,
- #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover-text,
- #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .wp-block-cover__inner-container,
- #editor .editor-styles-wrapper .wp-block-cover:not([class*="background-color"]) .block-editor-block-list__block,
- #editor .editor-styles-wrapper .wp-block-search .wp-block-search__button,
- #editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color',
- 'color',
- ),
- // Text-color darkened
- array( '#editor .editor-styles-wrapper .wp-block-separator.is-style-dots', 'color', '-1' ),
- // Background color darkened
- array(
- '#editor .editor-styles-wrapper .wp-block-table.is-style-stripes tbody tr:nth-child(odd),
- #editor .editor-styles-wrapper table.is-style-stripes tbody tr:nth-child(odd)',
- 'background-color',
- '-1',
- ),
- // Border-color darkened
- array( '#editor .editor-styles-wrapper .wp-block-code', 'border-color', '-1' ),
- // Border-top-color darkened
- array( '#editor .editor-styles-wrapper .wp-block-pullquote', 'border-top-color', '-1' ),
- // Border-bottom-color darkened
- array(
- '#editor .editor-styles-wrapper .wp-block-pullquote,
- #editor .editor-styles-wrapper .wp-block-separator',
- 'border-bottom-color',
- '-1',
- ),
- /**
- * Utility Classes
- */
- // Text-color
- array(
- '#editor .editor-styles-wrapper .has-primary-background-color[class],
- #editor .editor-styles-wrapper .has-secondary-background-color[class],
- #editor .editor-styles-wrapper .has-foreground-background-color[class],
- #editor .editor-styles-wrapper .has-foreground-dark-background-color[class],
- #editor .editor-styles-wrapper .has-foreground-light-background-color[class],
- #editor .editor-styles-wrapper .has-background-color[class]',
- 'color',
- ),
- // Background-color
- array(
- '#editor .editor-styles-wrapper .has-background-background-color[class],
- #editor .editor-styles-wrapper .wp-block .has-background-background-color[class]',
- 'background-color',
- ),
- // Text-color darkened
- array(
- '#editor .editor-styles-wrapper .has-background-dark-color[class],
- #editor .editor-styles-wrapper .wp-block .has-background-dark-color[class]',
- 'color',
- '-1',
- ),
- // Background-color darkened
- array(
- '#editor .editor-styles-wrapper .has-background-dark-background-color[class],
- #editor .editor-styles-wrapper .wp-block .has-background-dark-background-color[class]',
- 'background-color',
- '-1',
- ),
- // Text-color lightened
- array(
- '#editor .editor-styles-wrapper .has-background-light-color[class],
- #editor .editor-styles-wrapper .wp-block .has-background-light-color[class]',
- 'color',
- '+1',
- ),
- // Background-color lightened
- array(
- '#editor .editor-styles-wrapper .has-background-light-background-color[class],
- #editor .editor-styles-wrapper .wp-block .has-background-light-background-color[class]',
- 'background-color',
- '+1',
- ),
- ),
- __( 'Background Color' )
- );
- // Link Color
- // $config-global--color-primary-default
- add_editor_color_rule(
- 'link',
- '#CA2017',
- array(
- // Text-color
- array(
- '#editor .editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color),
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a:active,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a:focus,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a:hover,
- #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline,
- #editor .editor-styles-wrapper a',
- 'color',
- ),
- // Background-color
- array(
- '#editor .editor-styles-wrapper .button,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button,
- #editor .editor-styles-wrapper .wp-block-button:not(.is-style-outline) .wp-block-button__link:not(.has-background),
- #editor .editor-styles-wrapper .wp-block-search .wp-block-search__button,
- #editor .editor-styles-wrapper .wp-block-search .wp-block-search__button:focus,
- #editor .editor-styles-wrapper .wp-block-search .wp-block-search__button:hover,
- #editor .editor-styles-wrapper .wp-block-pullquote.is-style-solid-color',
- 'background-color',
- ),
- // Border color left
- array( '#editor .editor-styles-wrapper .wp-block-quote', 'border-left-color' ),
- // Border color right
- array(
- '#editor .editor-styles-wrapper .wp-block-quote[style*="text-align: right"],
- #editor .editor-styles-wrapper .wp-block-quote[style*="text-align:right"]',
- 'border-right-color',
- ),
- // Border-color (forms)
- array(
- '#editor .editor-styles-wrapper .wp-block-search .wp-block-search__input:focus,
- textarea:focus',
- 'border-color',
- ),
- /**
- * Utility Classes
- */
- // Text-color
- array(
- '#editor .editor-styles-wrapper .has-primary-color[class],
- #editor .editor-styles-wrapper .wp-block .has-primary-color[class]',
- 'color',
- ),
- // Background-color
- array(
- '#editor .editor-styles-wrapper .has-primary-background-color[class],
- #editor .editor-styles-wrapper .wp-block .has-primary-background-color[class]',
- 'background-color',
- ),
- ),
- __( 'Link Color' )
- );
- // Text Color
- // $config-global--color-foreground-default
- add_editor_color_rule(
- 'txt',
- '#222222',
- array(
- // Text-color
- array(
- '#editor .editor-styles-wrapper .editor-post-title__block .editor-post-title__input,
- #editor .editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link.has-focus,
- #editor .editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link:focus,
- #editor .editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link:hover,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .cat-links a:active,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .cat-links a:hover,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-meta a:active,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-meta a:hover,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-title a:hover,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .more-link:active,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .more-link:hover,
- #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline.has-focus,
- #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline:focus,
- #editor .editor-styles-wrapper .wp-block-button__link.is-style-outline:hover,
- #editor .editor-styles-wrapper .wp-block-pullquote,
- #editor .editor-styles-wrapper .wp-block-table.is-style-stripes tbody tr:nth-child(odd),
- #editor .editor-styles-wrapper table.is-style-stripes tbody tr:nth-child(odd),
- #editor .editor-styles-wrapper a:hover,
- #editor .editor-styles-wrapper',
- 'color',
- ),
- // Background-color
- array(
- '#editor .editor-styles-wrapper .button.has-focus,
- #editor .editor-styles-wrapper .button:focus,
- #editor .editor-styles-wrapper .button:hover,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:focus,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .button:hover,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts + .has-focus.button,
- #editor .editor-styles-wrapper .wp-block-button:not(.is-style-outline) .wp-block-button__link.has-focus,
- #editor .editor-styles-wrapper .wp-block-button:not(.is-style-outline) .wp-block-button__link:focus,
- #editor .editor-styles-wrapper .wp-block-button:not(.is-style-outline) .wp-block-button__link:hover,
- #editor .editor-styles-wrapper .wp-block-cover,
- #editor .editor-styles-wrapper .wp-block-cover.has-background-dim,
- #editor .editor-styles-wrapper .wp-block-cover-image,
- #editor .editor-styles-wrapper .wp-block-cover-image.has-background-dim',
- 'background-color',
- ),
- // Text-color brightened
- array(
- '#editor .editor-styles-wrapper .a8c-posts-list__item .a8c-posts-list-item__meta,
- #editor .editor-styles-wrapper .wp-block-image figcaption,
- #editor .editor-styles-wrapper .wp-block-latest-comments .wp-block-latest-comments__comment-date,
- #editor .editor-styles-wrapper .wp-block-latest-posts .wp-block-latest-posts__post-date,
- #editor .editor-styles-wrapper .wp-block-newspack-blocks-homepage-articles article .cat-links,
- #editor .editor-styles-wrapper .wp-block-newspack-blocks-homepage-articles article .entry-meta,
- #editor .editor-styles-wrapper .wp-block-pullquote .wp-block-pullquote__citation,
- #editor .editor-styles-wrapper .wp-block-pullquote cite,
- #editor .editor-styles-wrapper .wp-block-pullquote footer,
- #editor .editor-styles-wrapper .wp-block-quote .wp-block-quote__citation,
- #editor .editor-styles-wrapper .wp-block-quote cite,
- #editor .editor-styles-wrapper .wp-block-quote footer,
- #editor .editor-styles-wrapper .wp-block-quote.is-large .wp-block-quote__citation,
- #editor .editor-styles-wrapper .wp-block-quote.is-large cite,
- #editor .editor-styles-wrapper .wp-block-quote.is-large footer,
- #editor .editor-styles-wrapper .wp-block-quote.is-style-large .wp-block-quote__citation,
- #editor .editor-styles-wrapper .wp-block-quote.is-style-large cite,
- #editor .editor-styles-wrapper .wp-block-quote.is-style-large footer,
- #editor .editor-styles-wrapper .wp-block-video figcaption,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .cat-links,
- #editor .editor-styles-wrapper .wp-block-a8c-blog-posts .entry-meta,
- #editor .editor-styles-wrapper figcaption',
- 'color',
- '+2',
- ),
- /**
- * Utility Classes
- */
- // Text-color
- array(
- '#editor .editor-styles-wrapper .has-background-background-color[class],
- #editor .editor-styles-wrapper .wp-block .has-background-background-color[class],
- #editor .editor-styles-wrapper .has-background-dark-background-color[class],
- #editor .editor-styles-wrapper .wp-block .has-background-dark-background-color[class],
- #editor .editor-styles-wrapper .has-background-light-background-color[class],
- #editor .editor-styles-wrapper .wp-block .has-background-light-background-color[class],
- #editor .editor-styles-wrapper .has-foreground-color[class],
- #editor .editor-styles-wrapper .wp-block .has-foreground-color[class]',
- 'color',
- ),
- // Background-color
- array(
- '#editor .editor-styles-wrapper .has-foreground-background-color[class],
- #editor .editor-styles-wrapper .wp-block .has-foreground-background-color[class]',
- 'background-color',
- ),
- // Text-color darkened
- array(
- '#editor .editor-styles-wrapper .has-foreground-dark-color[class],
- #editor .editor-styles-wrapper .wp-block .has-foreground-dark-color[class]',
- 'color',
- '-1',
- ),
- // Background-color darkened
- array(
- '#editor .editor-styles-wrapper .has-foreground-dark-background-color[class],
- #editor .editor-styles-wrapper .wp-block .has-foreground-dark-background-color[class]',
- 'background-color',
- '-1',
- ),
- // Text-color brightened
- array(
- '#editor .editor-styles-wrapper .has-foreground-light-color[class],
- #editor .editor-styles-wrapper .wp-block .has-foreground-light-color[class]',
- 'color',
- '+2',
- ),
- // Background-color brightened
- array(
- '#editor .editor-styles-wrapper .has-foreground-light-background-color[class],
- #editor .editor-styles-wrapper .wp-block .has-foreground-light-background-color[class]',
- 'background-color',
- '+2',
- ),
- // Border-color with less opacity (dim)
- array(
- '#editor .editor-styles-wrapper .wp-block-code,
- #editor .editor-styles-wrapper .wp-block-search .wp-block-search__input',
- 'border-color',
- 0.8,
- ),
- ),
- __( 'Text Color' )
- );
- // Accent Color (Red)
- // $config-global--color-secondary-default
- add_editor_color_rule(
- 'fg1',
- '#007FDB',
- array(
- /**
- * Utility Classes
- */
- // Text-color
- array(
- '#editor .editor-styles-wrapper .has-secondary-color[class],
- #editor .editor-styles-wrapper .wp-block .has-secondary-color[class]',
- 'color',
- ),
- // Background-color
- array(
- '#editor .editor-styles-wrapper .has-secondary-background-color[class],
- #editor .editor-styles-wrapper .wp-block .has-secondary-background-color[class]',
- 'background-color',
- ),
- ),
- __( 'Secondary Color' )
- );
- /**
- * Custom CSS
- */
- function redhill_editor_custom_colors_extra_css() {
- $colors_array = get_theme_mod( 'colors_manager' );
- $bg = $colors_array['colors']['bg'];
- $txt = $colors_array['colors']['txt'];
- ?>
- #editor .editor-styles-wrapper .has-background:not(.has-background-background-color) a:not(.wp-block-button__link),
- #editor .editor-styles-wrapper p.has-text-color a {
- color: currentColor;
- }
- <?php
- }
- add_theme_support( 'custom_colors_extra_css', 'redhill_editor_custom_colors_extra_css' );
|