diff --git a/README.md b/README.md index 3579e8765..a3bbd3e48 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,12 @@ Crio is a WordPress SuperTheme that allows front-end designers, developers and o ## Changelog ## +### 2.20.0 ### +* Enhancement: Improve Color Palettes by using color variables instead of SCSS compilation during runtime [#50](https://github.com/BoldGrid/crio/issues/50) +* New Feature: Add notice to Design > Footer > Colors to help users [#48](https://github.com/BoldGrid/crio/issues/48) +* New Feature: If I add a logo but my header isn't setup to show it, show a warning [#49](https://github.com/BoldGrid/crio/issues/49) +* Accessibility: Hidden Tagline = Empty Heading Tag = Bad for Accessibility [#52](https://github.com/BoldGrid/crio/issues/52) + ### 2.19.2 ### * Bug Fix: If the first menu item has a dropdown there are padding issues in the dropdown [#39](https://github.com/BoldGrid/crio/issues/39) * Bug Fix: Cannot get even spacing between posts and header/footer on Blog Page [#38](https://github.com/BoldGrid/crio/issues/38) diff --git a/gulpfile.js b/gulpfile.js index 41cf7ba4b..10c836dfc 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -429,6 +429,18 @@ gulp.task('bootstrapCompile', function () { // .pipe( notify( { message: 'SCSS compile complete', onLast: true } ) ); }); +// Bootstrap Compile +gulp.task('colorPalettesCompile', function () { + gulp.src(config.dist + '/assets/scss/custom-color/color-palettes.scss') + .pipe(sass()) + .pipe(sass.sync().on('error', sass.logError)) + .pipe(gulp.dest(config.prime_dest + '/css' ) ) + .pipe(cssnano({ discardComments: { removeAll: true }, safe: true })) + .pipe(rename({ suffix: '.min' })) + .pipe(gulp.dest( config.prime_dest + '/css' ) ) + // .pipe( notify( { message: 'SCSS compile complete', onLast: true } ) ); +}); + // Watch for changes and recompile scss gulp.task('sass:watch', function () { gulp.watch( 'src/assets/scss/**/*.scss', function () { @@ -554,7 +566,7 @@ gulp.task( 'build', function( cb ) { ['jsHint', 'jscs', 'frameworkJs', 'svgs', 'tgm'], ['scssDeps', 'jsDeps', 'modernizr', 'fontDeps', 'phpDeps', 'frameworkFiles', 'copyScss'], 'images', - ['scssCompile', 'bootstrapCompile'], + ['scssCompile', 'bootstrapCompile', 'colorPalettesCompile' ], ['fontFamilyCss', 'patterns'], 'hovers', 'hoverColors', diff --git a/package.json b/package.json index 7329dfddb..8bff5c6ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "boldgrid-theme-framework", - "version": "2.19.2", + "version": "2.20.0", "description": "BoldGrid Theme Framework", "main": "index.js", "engines": { diff --git a/prime/inc/boldgrid-theme-framework-config/config.php b/prime/inc/boldgrid-theme-framework-config/config.php index ec9198a4c..33f55774e 100755 --- a/prime/inc/boldgrid-theme-framework-config/config.php +++ b/prime/inc/boldgrid-theme-framework-config/config.php @@ -219,8 +219,8 @@ function boldgrid_prime_framework_config( $config ) { $config['customizer']['controls']['bgtfw_header_color']['default'] = 'color-5'; // Footer specific colors for background, headings, and links. - $config['customizer']['controls']['bgtfw_footer_color']['default'] = 'color-5'; - $config['customizer']['controls']['bgtfw_footer_links']['default'] = 'color-1'; + $config['customizer']['controls']['bgtfw_footer_color']['default'] = 'color-5'; + $config['customizer']['controls']['bgtfw_footer_link_color']['default'] = get_theme_mod( 'bgtfw_footer_links', 'color-1' ); // Page title display settings, show by default. $config['customizer']['controls']['bgtfw_pages_title_display']['default'] = 'show'; diff --git a/readme.txt b/readme.txt index c124444e9..c58a43624 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: news, blog, e-commerce, sticky-post, theme-options, threaded-comments, ful Requires PHP: 5.6 Requires at least: 4.8 Tested up to: 6.2 -Stable tag: 2.19.2 +Stable tag: 2.20.0 License: GPL-3.0-or-later License URI: https://www.gnu.org/licenses/gpl-3.0-standalone.html @@ -14,13 +14,20 @@ Crio is a WordPress SuperTheme that allows designers, developers and other web p Crio is a WordPress SuperTheme that allows designers, developers and other web professionals to create without bounds or restrictions. Crio’s advanced customization options are completely integrated with the WordPress Customizer API, providing you with a powerful, but familiar interface to customize your website. Our integration gives you granular control over many elements straight from the Customizer, and even device previews so you can see how your site looks on different devices. Crio’s unique color palette system keeps colors consistent across your site. Drag and drop colors in your palette to increase or decrease the usage of that color throughout your website. Use the advanced controls to create a custom Header, Footer, or Blog Page layout. Be Bold and stand above the rest with Crio by BoldGrid! == Upgrade Notice == -= 2.10.0 = -This version includes CSS fixes for incorrect margin / padding issues. If you are using the Custom CSS as a temporary fix for these issues, this update may possibly conflict with your custom CSS. + += 2.20.0 = +This version changes the way the color palette CSS is generated. If you are using custom CSS to override color palettes, this may cause some conflicts. == Changelog == ## Changelog ## +== 2.20.0 == +* Enhancement: Improve Color Palettes by using color variables instead of SCSS compilation during runtime [#50](https://github.com/BoldGrid/crio/issues/50) +* New Feature: Add notice to Design > Footer > Colors to help users [#48](https://github.com/BoldGrid/crio/issues/48) +* New Feature: If I add a logo but my header isn't setup to show it, show a warning [#49](https://github.com/BoldGrid/crio/issues/49) +* Accessibility: Hidden Tagline = Empty Heading Tag = Bad for Accessibility [#52](https://github.com/BoldGrid/crio/issues/52) + == 2.19.2 == * Bug Fix: If the first menu item has a dropdown there are padding issues in the dropdown [#39](https://github.com/BoldGrid/crio/issues/39) * Bug Fix: Cannot get even spacing between posts and header/footer on Blog Page [#38](https://github.com/BoldGrid/crio/issues/38) diff --git a/src/assets/js/customizer/color-palette-generate.js b/src/assets/js/customizer/color-palette-generate.js index 65f9945fd..408b67590 100644 --- a/src/assets/js/customizer/color-palette-generate.js +++ b/src/assets/js/customizer/color-palette-generate.js @@ -93,6 +93,138 @@ BOLDGRID.COLOR_PALETTE.Generate = BOLDGRID.COLOR_PALETTE.Generate || {}; '#1a1a1a' ]; + /** + * Css Variables. + * + * Generate CSS Variables for a color palette. + * + * @ since 2.20.0 + * + * @param {object} colorPalette The Color Palette Object. + * + * @returns string CSS Variables string. + */ + self.cssVariables = function( colorPalette ) { + var css = '', + formattedPalette = {}; + + $.each( colorPalette.colors, function( index, color ) { + var colorIndex = index + 1; + + formattedPalette['color-' + colorIndex ] = color; + } ); + + formattedPalette['color-neutral'] = colorPalette['neutral-color']; + + $.each( formattedPalette, function( variable, color ) { + css += `--${variable}: ${color};`; + css += `--${variable}-raw: ` + color.replace( 'rgb(', '' ).replace( ')', '' ) + ';'; + css += `--${variable}-light:` + net.brehaut.Color( color ).lightenByAmount( 0.1 ).toCSS() + ';'; + css += self.generateHoverVars( formattedPalette, variable, color ); + } ); + + return css; + }; + + /** + * Generates CSS Variables for hover colors. + * + * @since 2.20.0 + * + * @param {object} formattedPalette Formatted colors object. + * @param {string} textVariable Text color variable. + * @param {string} textColor Text color value. + * + * @returns {string} CSS Variables string. + */ + self.generateHoverVars = function( formattedPalette, textVariable, textColor ) { + var textIndex = textVariable.replace( 'color-', '' ), + hoverVars = ''; + + $.each( formattedPalette, function( bgVariable, bgColor ) { + var bgIndex = bgVariable.replace( 'color-', '' ), + hoverColor = self.getHoverColor( + net.brehaut.Color( bgColor ), + net.brehaut.Color( textColor ) + ); + + hoverVars += `--bg-${bgIndex}-text-${textIndex}-hover: ${hoverColor};`; + } ); + + return hoverVars; + }; + + /** + * Get Hover Color. + * + * All the logic for determining the hover color was + * derived from the SCSS functions defined prior to the + * 2.2.0 release in the following file: + * + * src/assets/scss/custom-color/color-palettes.scss + * + * @since 2.20.0 + * + * @param {Color} BgColor Background Color object. + * @param {Color} TextColor Text Color object. + * + * @returns {string} RGB Color value. + */ + self.getHoverColor = function( BgColor, TextColor ) { + var textLightness = TextColor.getLightness(), + bgLightness = BgColor.getLightness(), + hoverColor; + + // White Text + if ( 1 === textLightness ) { + + // Dark Background + if ( 0.9 <= bgLightness ) { + hoverColor = BgColor.darkenByAmount( 0.15 ); + + // Light Background + } else { + hoverColor = BgColor.blend( TextColor, 0.8 ); + } + + // Black Text + } else if ( 0 === textLightness ) { + + // Dark Background + if ( 0.10 > bgLightness ) { + hoverColor = BgColor.lightenByAmount( 0.2 ); + + // Light Background + } else { + hoverColor = BgColor.blend( TextColor, 0.6 ); + } + + // Light Text on Dark Background. + } else if ( bgLightness < textLightness ) { + + // Color is too light to lighten. + if ( 0.9 < textLightness ) { + hoverColor = TextColor.darkenByAmount( 0.2 ); + } else { + hoverColor = TextColor.lightenByAmount( 0.2 ); + } + + // Dark Text on Light Background. + } else { + + // Color is too dark to darken. + if ( 0.15 > textLightness ) { + hoverColor = TextColor.lightenByAmount( 0.2 ); + } else { + hoverColor = TextColor.darkenByAmount( 0.2 ); + } + } + + hoverColor = hoverColor.toRGB(); + + return 'rgb(' + Math.floor( hoverColor.red * 255 ) + ',' + Math.floor( hoverColor.green * 255 ) + ',' + Math.floor( hoverColor.blue * 255 ) + ')'; + }; + /** * Get a random color * Not Used ATM diff --git a/src/assets/js/customizer/color-palette-preview.js b/src/assets/js/customizer/color-palette-preview.js index 3fc25f70a..599f9d540 100644 --- a/src/assets/js/customizer/color-palette-preview.js +++ b/src/assets/js/customizer/color-palette-preview.js @@ -22,6 +22,117 @@ BOLDGRID.COLOR_PALETTE.Preview = BOLDGRID.COLOR_PALETTE.Preview || {}; } }); + /** + * Update CSS overlay colors. + * + * CSS Overlay colors are translucent background colors + * added to elements using PPB. These are currently added using head inline CSS + * since the PPB added this feature before we added the --color-x-raw variables. + * + * This method will update the inline CSS to use the --color-x-raw variables when + * the palette is changed. However, in the future, we should update PPB to use + * the --color-x-raw variables instead of inline CSS. + * + * @since 2.20.0 + */ + self.updateOverlayColors = function() { + var $bgColorElements = $( '[class*="-background-color"]' ), + $imgOverlayElements = $( '[data-bg-overlaycolor-class]' ), + $fwrElements = $( '[class*="fwr-"]' ), + rawColorValues = { + 'color-1-raw': $( ':root' ).css( '--color-1-raw' ), + 'color-2-raw': $( ':root' ).css( '--color-2-raw' ), + 'color-3-raw': $( ':root' ).css( '--color-3-raw' ), + 'color-4-raw': $( ':root' ).css( '--color-4-raw' ), + 'color-5-raw': $( ':root' ).css( '--color-5-raw' ), + 'color-neutral-raw': $( ':root' ).css( '--color-neutral-raw' ), + }; + + $bgColorElements.each( ( _, el ) => { + var $bgColorEl = $( el ), + bgUuid = $bgColorEl.attr( 'data-bg-uuid' ), + $fwrInlineStyle = $( `#${bgUuid}-inline-css` ); + + $fwrInlineStyle.each( ( _, el ) => { + self.updateBgColorOverlays( el, rawColorValues ); + } ); + } ); + + $imgOverlayElements.each( ( _, el ) => { + self.updateImageOverlays( el, rawColorValues ); + } ); + + $fwrElements.each( ( _, el ) => { + var $fwr = $( el ), + classList = $fwr.attr( 'class' ), + fwrId = 'fwr-' + classList.match( /fwr-?(\d+)/ )[1], + $fwrInlineStyle = $( `#${fwrId}-inline-css` ); + + $fwrInlineStyle.each( ( _, el ) => { + self.updateBgColorOverlays( el, rawColorValues ); + } ); + } ); + }; + + /** + * Updage Image Overlay colors. + * + * Elements that have a translucent color overlaying the + * background image that uses a color from the palette, + * has the background-image property set in the elements' + * inline styles. + * + * @since 2.20.0 + * + * @param {object} el Image overlay element. + * @param {object} rawColorValues Raw color values. + */ + self.updateImageOverlays = function( el, rawColorValues ) { + var $el = $( el ), + elStyle = $el.attr( 'style' ), + colorIndex = $el.attr( 'data-bg-overlaycolor-class' ), + overlayValue = rawColorValues[`color-${colorIndex}-raw`], + overlayVariable = `var(--color-${colorIndex}-raw)`, + colorMatches = elStyle.match( new RegExp( overlayValue, 'g' ) ); + + // If the color value is not found, try removing the spaces. + if ( ! colorMatches ) { + overlayValue = overlayValue.replace( /\s/g, '' ); + colorMatches = elStyle.match( new RegExp( overlayValue, 'g' ) ); + } + + $el.attr( + 'style', + elStyle.replace( new RegExp( overlayValue, 'g' ), overlayVariable ) + ); + }; + + + /** + * Update BG Color Overlays. + * + * Elements with a translucent background color + * that uses a color from the palette, and does not + * have a background image, has the background properties + * set in the
inline style element. This handles + * Full Width Rows as well. + * + * @since 2.20.0 + * + * @param {object} inlineStyleEl inline style element. + * @param {object} rawColorValues Raw color values. + */ + self.updateBgColorOverlays = function( inlineStyleEl, rawColorValues ) { + var $inlineStyleEl = $( inlineStyleEl ), + styleString = $inlineStyleEl.html(); + + _.each( rawColorValues, ( colorRawValue, colorRawVariable ) => { + styleString = styleString.replace( new RegExp( colorRawValue, 'g' ), `var(--${colorRawVariable})` ); + } ); + + $inlineStyleEl.html( styleString ); + }; + /** * Main responsibility of this file * The to parameter, is a json string that is inside of a textarea in the parent window @@ -44,7 +155,11 @@ BOLDGRID.COLOR_PALETTE.Preview = BOLDGRID.COLOR_PALETTE.Preview || {}; // Update styles. style = document.getElementById( 'boldgrid-color-palettes-inline-css' ); - style.innerHTML = modify.compiled_css; + if ( style ) { + style.innerHTML = ':root{' + modify.css_variables + '}'; + } else { + $( 'head' ).append( '' ); + } }; /** @@ -59,6 +174,9 @@ BOLDGRID.COLOR_PALETTE.Preview = BOLDGRID.COLOR_PALETTE.Preview || {}; .val( parent.BOLDGRID.COLOR_PALETTE.Modify.compiled_css ) .change(); } ); + + // Update overlay colors. + self.updateOverlayColors(); } ); wp.customize( 'boldgrid_compiled_css', function( value ) { diff --git a/src/assets/js/customizer/color-palette.js b/src/assets/js/customizer/color-palette.js index 2645abdb0..888c8c60a 100644 --- a/src/assets/js/customizer/color-palette.js +++ b/src/assets/js/customizer/color-palette.js @@ -1045,6 +1045,9 @@ BOLDGRID.COLOR_PALETTE.Modify = BOLDGRID.COLOR_PALETTE.Modify || {}; * Change the palette settings */ colorPalette.update_palette_settings = function() { + colorPalette.css_variables = BOLDGRID.COLOR_PALETTE.Generate.cssVariables( colorPalette.state.palettes['palette-primary'] ); + colorPalette.state.css_variables = colorPalette.css_variables; + colorPalette.text_area_val = JSON.stringify({ 'state': colorPalette.state }); wp.customize( 'boldgrid_color_palette' ).set( '' ).set( colorPalette.text_area_val ); }; diff --git a/src/assets/js/customizer/color/preview.js b/src/assets/js/customizer/color/preview.js index 86e6274c8..d51768d5f 100644 --- a/src/assets/js/customizer/color/preview.js +++ b/src/assets/js/customizer/color/preview.js @@ -49,9 +49,9 @@ export class Preview { properties: [ 'color', 'color-hover' ] }, { - name: 'bgtfw_footer_links', - selector: '.footer-content:not(.template-footer)', - properties: [ 'link-color' ] + name: 'bgtfw_footer_link_color', + selector: '#colophon .bgtfw-footer.footer-content:not(.template-footer) .attribution-theme-mods > .link > a:not( .btn ):hover', + properties: [ 'color' ] } ]; } diff --git a/src/assets/js/customizer/customizer.js b/src/assets/js/customizer/customizer.js index d4ff571dc..7baf2d56a 100644 --- a/src/assets/js/customizer/customizer.js +++ b/src/assets/js/customizer/customizer.js @@ -547,6 +547,10 @@ BOLDGRID.Customizer.Util.getInitialPalettes = function( option ) { value.bind( function( to ) { var palettes, colors; + if ( ! to ) { + to = parent.BOLDGRID.COLOR_PALETTE.Modify.text_area_val; + } + palettes = parent.jQuery( '.colors-wrapper' ); colors = BOLDGRID.Customizer.Util.getInitialPalettes( to ); diff --git a/src/assets/js/customizer/header-layout/header-layout.js b/src/assets/js/customizer/header-layout/header-layout.js index 2ba12e16e..0eef17887 100644 --- a/src/assets/js/customizer/header-layout/header-layout.js +++ b/src/assets/js/customizer/header-layout/header-layout.js @@ -562,6 +562,18 @@ export class HeaderLayout { } } ); + controlApi.section( 'title_tagline' ).expanded.bind( ( isExpanded ) => { + if ( isExpanded ) { + this.brandingNotices( controlApi( 'bgtfw_header_preset_branding' )(), controlApi.control( 'custom_logo' ) ); + } + } ); + + controlApi( 'custom_logo', ( control ) => { + control.bind( () => { + this.brandingNotices( controlApi( 'bgtfw_header_preset_branding' )(), controlApi.control( 'custom_logo' ) ); + } ); + } ); + /* * bgtfw_header_presets * @@ -1059,7 +1071,9 @@ export class HeaderLayout { * @param {wp.customize.control} control Customizer Control object. */ brandingNotices( value, control ) { - var container = control.container; + var container = control.container, + controlId = control.id; + container.find( '.branding_notice' ).hide(); if ( value.includes( 'logo' ) && ! controlApi( 'custom_logo' )() ) { @@ -1085,6 +1099,15 @@ export class HeaderLayout { controlApi.control( 'blogdescription' ).focus(); } ); } + + if ( 'custom_logo' === controlId && ! value.includes( 'logo' ) && controlApi( 'custom_logo' )() ) { + container.find( '.branding_notice.logo_set' ).show(); + container.find( '.branding_notice.logo_set a' ).off( 'click' ); + container.find( '.branding_notice.logo_set a' ).on( 'click', ( e ) => { + e.preventDefault(); + controlApi.control( 'bgtfw_header_preset_branding' ).focus(); + } ); + } } /** diff --git a/src/assets/js/customizer/typography/link-preview.js b/src/assets/js/customizer/typography/link-preview.js index 59b625d1c..927c4a70a 100644 --- a/src/assets/js/customizer/typography/link-preview.js +++ b/src/assets/js/customizer/typography/link-preview.js @@ -14,6 +14,7 @@ export class LinkPreview { this.paletteSelector = new PaletteSelector(); this.prefixes = [ 'bgtfw_body', + 'bgtfw_footer', 'bgtfw_posts_date', 'bgtfw_posts_byline', 'bgtfw_posts_tags', @@ -52,6 +53,10 @@ export class LinkPreview { controls.push( `${prefix}_link_color_display` ); } + if ( 'bgtfw_footer' === prefix ) { + controls = [ `${prefix}_link_color` ]; + } + api( ...controls, ( ...args ) => { args.map( control => control.bind( () => this.updateStyles( prefix ) ) ); } ); @@ -83,13 +88,24 @@ export class LinkPreview { updateStyles( prefix ) { let css = ''; if ( false === _.isFunction( api( `${prefix}_link_color_display` ) ) || 'inherit' !== api( `${prefix}_link_color_display` )() ) { - let linkColor = this._getColor( `${prefix}_link_color`, true ), - linkColorHover = api( `${prefix}_link_color_hover` )() || 0, - decoration = this._getDecoration( `${prefix}_link_decoration` ), + let linkColor, linkColorHover, decoration, decorationHover, excludes, selectors, shiftedColorVal; + if ( 'bgtfw_footer' === prefix ) { + linkColor = this._getColor( `${prefix}_link_color`, true ), + linkColorHover = api( 'bgtfw_body_link_color_hover' )() || 0, + decoration = this._getDecoration( 'bgtfw_body_link_decoration' ), + decorationHover = this._getDecoration( 'bgtfw_body_link_decoration_hover' ), + excludes = '', + selectors = this.selectors[ prefix ], + shiftedColorVal; + } else { + linkColor = this._getColor( `${prefix}_link_color`, true ), + linkColorHover = api( `${prefix}_link_color_hover` )() || 0, + decoration = this._getDecoration( `${prefix}_link_decoration` ), decorationHover = this._getDecoration( `${prefix}_link_decoration_hover` ), - excludes = '', - selectors = this.selectors[ prefix ], + excludes = '', + selectors = this.selectors[ prefix ], shiftedColorVal; + } linkColorHover = parseInt( linkColorHover, 10 ) / 100; @@ -104,7 +120,7 @@ export class LinkPreview { } ${selector}:hover, ${selector}:focus { - color: ${shiftedColorVal}; + color: ${shiftedColorVal} !important; text-decoration: ${decorationHover}; } `; @@ -115,14 +131,13 @@ export class LinkPreview { * controlled by the Site Content Link typography controls. */ if ( 'bgtfw_body' === prefix ) { - let footerLinkColor = this._getColor( 'bgtfw_footer_links', true ), - footerLinkColorHover = api( `${prefix}_link_color_hover` )() || 0, - footerShiftedColorVal; - - footerLinkColorHover = parseInt( footerLinkColorHover, 10 ) / 100, - footerShiftedColorVal = colorLib.Color( footerLinkColor ).lightenByAmount( footerLinkColorHover ).toCSS(); + let colorPaletteOption = api( 'boldgrid_color_palette' )(); - let colorPaletteOption = JSON.parse( api( 'boldgrid_color_palette' )() ); + if ( colorPaletteOption ) { + colorPaletteOption = JSON.parse( api( 'boldgrid_color_palette' )() ); + } else { + colorPaletteOption = parent.BOLDGRID.COLOR_PALETTE.Modify; + } let paletteColors = colorPaletteOption.state.palettes['palette-primary'].colors; let paletteNeutral = colorPaletteOption.state.palettes['palette-primary']['neutral-color']; @@ -138,19 +153,8 @@ export class LinkPreview { css += `.sidebar.color-${sidebarColorClass}-link-color a:not( .btn ):hover, .sidebar.color-${sidebarColorClass}-link-color a:not( .btn ):focus { color: ${sidebarAriColor} !important; }`; } ); - css += ` - #colophon .bgtfw-footer.footer-content > a:not( .btn ), - #colophon .bgtfw-footer.footer-content *:not( .menu-item ) > a:not( .btn ) { - text-decoration: ${decoration}; - } - #colophon .bgtfw-footer.footer-content > a:not( .btn ):hover, - #colophon .bgtfw-footer.footer-content > a:not( .btn ):focus, - #colophon .bgtfw-footer.footer-content *:not( .menu-item ) > a:not( .btn ):hover, - #colophon .bgtfw-footer.footer-content *:not( .menu-item ) > a:not( .btn ):focus { - color: ${footerShiftedColorVal}; - text-decoration: ${decorationHover}; - } - `; + // footer Link Color. + this.updateStyles( 'bgtfw_footer' ); } } diff --git a/src/assets/scss/boldgrid/_elements.scss b/src/assets/scss/boldgrid/_elements.scss index 00cff63b1..aa715667a 100644 --- a/src/assets/scss/boldgrid/_elements.scss +++ b/src/assets/scss/boldgrid/_elements.scss @@ -366,3 +366,21 @@ body.bgtfw-edit-links-hidden .bgtfw-edit-link a { transform: scale3d(.3, .3, .3); } } + +.palette-primary { + .color1-background-alpha { + background-color: rgba( var(--color-1-raw), 0.7 ); + } + .color2-background-alpha { + background-color: rgba( var(--color-2-raw), 0.7 ); + } + .color3-background-alpha { + background-color: rgba( var(--color-3-raw), 0.7 ); + } + .color4-background-alpha { + background-color: rgba( var(--color-4-raw), 0.7 ); + } + .color5-background-alpha { + background-color: rgba( var(--color-5-raw), 0.7 ); + } +} diff --git a/src/assets/scss/custom-color/color-classes.scss b/src/assets/scss/custom-color/color-palettes.scss similarity index 50% rename from src/assets/scss/custom-color/color-classes.scss rename to src/assets/scss/custom-color/color-palettes.scss index 2953a2b19..be78ec25e 100644 --- a/src/assets/scss/custom-color/color-classes.scss +++ b/src/assets/scss/custom-color/color-palettes.scss @@ -1,127 +1,54 @@ -@function hover($background, $color) { - $style: ''; - $hover-color: ''; - $color-lightness: abs(lightness($color)); - $background-lightness: abs(lightness($background)); +$colors: ( var(--color-1), var(--color-2), var(--color-3), var(--color-4), var(--color-5) ); - @if $color-lightness == 100 { - /* White */ - @if $background-lightness >= 90 { - $hover-color: darken($background, 15); - } @else { - $hover-color: mix($color, $background, 80); - } - } @else if $color-lightness == 0 { - /* Black */ - @if $background-lightness < 10 { - $hover-color: lighten($background, 20); - } @else { - $hover-color: mix($color, $background, 60); - } - } @else if $background-lightness < $color-lightness { - /* Light text on dark background */ - $style: 'lighten'; - @if $color-lightness > 90 { - /* Color too light to lighten */ - $hover-color: darken($color, 20); - $style: 'darken'; - } @else { - $hover-color: lighten($color, 20); - } - } @else { - /* Dark text on light background */ - $style: 'darken'; - @if $color-lightness < 15 { - /* Color is too dark to further darken */ - $hover-color: lighten($color, 20); - $style: 'lighten'; - } @else { - $hover-color: darken($color, 20); - } - } - - @return $hover-color; -} +$palette-primary_1: var(--color-1); +$palette-primary_2: var(--color-2); +$palette-primary_3: var(--color-3); +$palette-primary_4: var(--color-4); +$palette-primary_5: var(--color-5); +$palette-primary-neutral-color: var(--color-neutral); $ubtn-colors: (); -@if variable-exists( palette-primary_1 ) { - $ubtn-colors: append($ubtn-colors,('color-1' $palette-primary_1 var(--color-1-text-contrast))); - @if $ubtn-theme-color == 'palette-primary_1' { - $ubtn-bgcolor: $palette-primary_1; - $ubtn-font-color: var(--color-1-text-contrast); - } -} -@if variable-exists( palette-primary_2 ) { - $ubtn-colors: append($ubtn-colors,('color-2' $palette-primary_2 var(--color-2-text-contrast))); - @if $ubtn-theme-color == 'palette-primary_2' { - $ubtn-bgcolor: $palette-primary_2; - $ubtn-font-color: var(--color-2-text-contrast); - } -} -@if variable-exists( palette-primary_3 ) { - $ubtn-colors: append($ubtn-colors,('color-3' $palette-primary_3 var(--color-3-text-contrast))); - @if $ubtn-theme-color == 'palette-primary_3' { - $ubtn-bgcolor: $palette-primary_3; - $ubtn-font-color: var(--color-3-text-contrast); - } -} -@if variable-exists( palette-primary_4 ) { - $ubtn-colors: append($ubtn-colors,('color-4' $palette-primary_4 var(--color-4-text-contrast))); - @if $ubtn-theme-color == 'palette-primary_4' { - $ubtn-bgcolor: $palette-primary_4; - $ubtn-font-color: var(--color-4-text-contrast); - } -} -@if variable-exists( palette-primary_5 ) { - $ubtn-colors: append($ubtn-colors,('color-5' $palette-primary_5 var(--color-5-text-contrast))); - @if $ubtn-theme-color == 'palette-primary_5' { - $ubtn-bgcolor: $palette-primary_5; - $ubtn-font-color: var(--color-5-text-contrast); - } -} -@if variable-exists( palette-primary-neutral-color ) { - $ubtn-colors: append($ubtn-colors,('neutral-color' $palette-primary-neutral-color var(--color-neutral-text-contrast))); - @if $ubtn-theme-color == 'palette-primary-neutral-color' { - $ubtn-bgcolor: $palette-primary-neutral-color; - $ubtn-font-color: var(--color-neutral-text-contrast); - } -} -@if variable-exists( palette-primary-transparent-color ) { - $ubtn-colors: append($ubtn-colors,('transparent-color' $palette-primary-transparent-color var(--color-neutral-text-contrast))); - @if $ubtn-theme-color == 'palette-primary-transparent-color' { - $ubtn-bgcolor: $palette-primary-transparent-color; - $ubtn-font-color: var(--color-neutral-text-contrast); - } -} +$ubtn-colors: append($ubtn-colors,('color-1' var( --color-1 ) var(--color-1-text-contrast) var( --color-1-light ) var( --color-1-dark ) )); + +$ubtn-colors: append($ubtn-colors,('color-2' var( --color-2 ) var(--color-2-text-contrast) var( --color-2-light ) var( --color-2-dark ))); + +$ubtn-colors: append($ubtn-colors,('color-3' var( --color-3 ) var(--color-3-text-contrast) var( --color-3-light ) var( --color-3-dark ))); + +$ubtn-colors: append($ubtn-colors,('color-4' var( --color-4 ) var(--color-4-text-contrast) var( --color-4-light ) var( --color-4-dark ))); + +$ubtn-colors: append($ubtn-colors,('color-5' var( --color-5 ) var(--color-5-text-contrast) var( --color-5-light ) var( --color-5-dark ))); + +$ubtn-colors: append($ubtn-colors,('neutral-color' var( --color-neutral ) var(--color-neutral-text-contrast) var( --color-neutral-light ) var( --color-neutral-dark ))); + /* Create single css classes to apply palettes on universal elements. */ $names: background background-color; .sidebar.transparent-background-color { @for $color from 1 through length( $colors ) { @for $each from 1 through length( $colors ) { - $reference: nth($colors, $color); + $reference: var(--color-#{$color}); &.color-#{$each}-link-color { a:not( .btn ) { - color: #{nth($colors, $each)}; + color: var(--color-#{$each}); } } } @if variable-exists( palette-primary-neutral-color ) { &.color-neutral-link-color { a:not( .btn ) { - color: $palette-primary-neutral-color; + color: var(--color-neutral); } } &.color-neutral-sub-link-color.sm { ul.sub-menu:not( .custom-sub-menu ) { li.menu-item { > a:not(.btn) { - color: $palette-primary-neutral-color; + color: var(--color-neutral); } > a:not(.btn) { &:hover, &:focus, &:active, &.highlighted { - color: hover( nth($colors, $color), $palette-primary-neutral-color ); + color: var(--bg-#{$color}-text-neutral-hover); } } } @@ -130,25 +57,25 @@ $names: background background-color; } &-hover { &:focus, &:hover { - background-color: nth($colors, $color) ! important; + background-color: var(--color-#{$color}) ! important; } } } } @for $i from 1 through length( $names ) { @for $color from 1 through length( $colors ) { - $reference: nth($colors, $color); + $reference: var(--color-#{$color}); .color#{$color}-#{nth( $names, $i )} { @for $each from 1 through length( $colors ) { &.color-#{$each}-link-color { li.menu-item:not( .custom-sub-menu ), .attribution-theme-mods .link { > a:not( .btn ) { - color: #{nth($colors, $each)}; + color: var(--color-#{$each}); } > a:not( .btn ) { &:hover, &:focus, &:active, &.highlighted { - color: hover( nth($colors, $color), nth($colors, $each) ); + color: var(--bg-#{$color}-text-#{$each}-hover); } } } @@ -159,11 +86,11 @@ $names: background background-color; &.panel-footer { &.color-#{$each}-link-color { a:not( .btn ) { - color: #{nth($colors, $each)}; + color: var(--color-#{$each}); } > a:not( .btn ) { &:hover, &:focus, &:active, &.highlighted { - color: hover( nth($colors, $color), nth($colors, $each) ); + color: var(--bg-#{$color}-text-#{$each}-hover); } } } @@ -171,7 +98,7 @@ $names: background background-color; &.sidebar { &.color-#{$each}-link-color { a:not( .btn ) { - color: #{nth($colors, $each)}; + color: var(--color-#{$each}); } } } @@ -189,11 +116,11 @@ $names: background background-color; } li.menu-item:not( .custom-sub-menu ) { > a:not(.btn) { - color: #{nth($colors, $each)}; + color: var(--color-#{$each}); } > a:not(.btn) { &:hover, &:focus, &:active, &.highlighted { - color: hover( nth($colors, $color), nth($colors, $each) ); + color: var(--bg-#{$color}-text-#{$each}-hover); } } } @@ -201,9 +128,9 @@ $names: background background-color; &.color-#{$subeach}-sub-link-color { li.menu-item:not( .custom-sub-menu ) { ul.sub-menu:not( .custom-sub-menu ) > a:not(.btn) { - color: #{nth($colors, $subeach)}; + color: var(--color-#{$subeach}); &:hover, &:focus, &:active, &.highlighted { - color: hover( nth($colors, $subeach), nth($colors, $subeach) ); + color: var(--bg-#{$color}-text-#{$subeach}-hover); } } } @@ -216,9 +143,9 @@ $names: background background-color; &.color-neutral-link-color { a { &:not( .in-mega ):not( .btn ) { - color: $palette-primary-neutral-color; + color: var(--color-neutral); &:hover, &:focus, &:active, &.highlighted { - color: hover( nth($colors, $color), $palette-primary-neutral-color ); + color: var(--bg-#{$color}-text-neutral-hover); } } } @@ -227,9 +154,9 @@ $names: background background-color; ul.sub-menu:not( .custom-sub-menu ) { li.menu-item:not( .custom-sub-menu ) { > a:not(.btn) { - color: $palette-primary-neutral-color; + color: var(--color-neutral); &:hover, &:focus, &:active, &.highlighted { - color: hover( nth($colors, $color), $palette-primary-neutral-color ); + color: var(--bg-#{$color}-text-neutral-hover); } } } @@ -240,9 +167,9 @@ $names: background background-color; ul.sub-menu:not( .custom-sub-menu ) { li.menu-item:not( .custom-sub-menu ) { > a:not(.btn) { - color: #{nth($colors, $subEach)}; + color: var(--color-#{$subEach}); &:hover, &:focus, &:active, &.highlighted { - color: hover( nth($colors, $color), nth($colors, $subEach) ); + color: var(--bg-#{$color}-text-#{$subEach}-hover); } } } @@ -262,11 +189,11 @@ $names: background background-color; @for $each from 1 through length( $colors) { &.color-#{$each}-link-color { a { - color: #{nth($colors, $each)}; + color: var(--color-#{$each}); } &:not( .sidebar ) { a:hover, a:focus, a:active, a.highlighted { - color: hover( $palette-primary-neutral-color, nth($colors, $each) ); + color: var(--bg-neutral-text-#{$each}-hover); } } } @@ -274,9 +201,9 @@ $names: background background-color; ul.sub-menu:not( .custom-sub-menu ) { li.menu-item:not( .custom-sub-menu ) { > a:not(.btn) { - color: #{nth($colors, $each)}; + color: var(--color-#{$each}); &:hover, &:focus, &:active, &.highlighted { - color: hover( $palette-primary-neutral-color, nth($colors, $each) ); + color: var(--bg-neutral-text-#{$each}-hover); } } } @@ -285,19 +212,19 @@ $names: background background-color; } &.color-neutral-link-color { a { - color: $palette-primary-neutral-color; + color: var(--color-neutral); } a:hover, a:focus, a:active, a.highlighted { - color: hover( $palette-primary-neutral-color, $palette-primary-neutral-color ); + color: var(--bg-neutral-text-neutral-hover); } } &.color-neutral-sub-link-color.sm { ul.sub-menu:not( .custom-sub-menu ) { li.menu-item:not( .custom-sub-menu ) { > a:not(.btn) { - color: $palette-primary-neutral-color; + color: var(--color-neutral); &:hover, &:focus, &:active, &.highlighted { - color: hover( $palette-primary-neutral-color, $palette-primary-neutral-color ); + color: var(--bg-neutral-text-neutral-hover); } } } @@ -317,8 +244,11 @@ $names: background background-color; @each $ubtn-color in $ubtn-colors { $ubtn-name: nth($ubtn-color, 1); $ubtn-background: nth($ubtn-color, 2); + $ubtn-bg-light: nth($ubtn-color, 4); + $ubtn-bg-dark: nth($ubtn-color, 5); $ubtn-color: nth($ubtn-color, 3); + // Crete class for .button-primary // and legacy flat .button-primary-flat .btn-#{$ubtn-name}, @@ -328,6 +258,12 @@ $names: background background-color; background-color: $ubtn-background !important; border-color: $ubtn-background; color: $ubtn-color; + &.btn-raised { + background: linear-gradient( $ubtn-background, $ubtn-bg-light ) !important; + &:hover, &:focus { + background: linear-gradient( $ubtn-bg-light, $ubtn-background ) !important; + } + } a { color: $ubtn-color; } @@ -341,8 +277,8 @@ $names: background background-color; &:hover, &:focus { - background-color: lighten($ubtn-background, 10%) !important; - border-color: lighten($ubtn-background, 10%); + background-color: $ubtn-bg-light !important; + border-color: $ubtn-bg-light; color: $ubtn-color; a { color: $ubtn-color; @@ -352,9 +288,9 @@ $names: background background-color; &:active, &.active, &.is-active { - background-color: desaturate($ubtn-background, 10%) !important; - border-color: desaturate($ubtn-background, 10%); - color: darken($ubtn-background, 10%); + background-color: $ubtn-bg-light !important; + border-color: $ubtn-bg-light; + color: $ubtn-color; a { color: $ubtn-color; } @@ -373,13 +309,13 @@ $names: background background-color; &:hover, &:focus { &.btn-transparent{ - background-color: lighten($ubtn-background, 10%) !important; + background-color: $ubtn-bg-light !important; color: $ubtn-color; a { color: $ubtn-color; } } - border-color: lighten($ubtn-background, 10%) !important; + border-color: $ubtn-bg-light !important; } @@ -387,13 +323,13 @@ $names: background background-color; &.active, &.is-active { &.btn-transparent{ - background-color: lighten($ubtn-background, 10%) !important; - color: darken($ubtn-background, 10%); + background-color: $ubtn-bg-light !important; + color: $ubtn-color; a { color: $ubtn-color; } } - border-color: desaturate($ubtn-background, 10%) !important; + border-color: $ubtn-bg-light !important; } } } diff --git a/src/assets/scss/customizer/controls/_link-colors.scss b/src/assets/scss/customizer/controls/_link-colors.scss index 9ae72f800..bbc39ce5f 100644 --- a/src/assets/scss/customizer/controls/_link-colors.scss +++ b/src/assets/scss/customizer/controls/_link-colors.scss @@ -1,7 +1,7 @@ [id^="customize-control-bgtfw_"] { &[id$="_link_color"], &[id$="_link_color_display"] { - &:not( [id$="_link_color_display"] ), + &:not( [id$="_link_color_display"] ):not( [id$="_footer_link_color"] ), ~ [id$="_link_color"], ~ [id$="_link_color_hover"], ~ [id$="_link_decoration"], @@ -22,7 +22,7 @@ padding-bottom: 12px; border-bottom: 1px solid rgba(0, 0, 0, 0.1); } - &[id$="_link_color"] { + &[id$="_link_color"]:not( [id$="_footer_link_color"] ) { border-top: 1px solid rgba(0, 0, 0, 0.1); } &[id$="_link_color_display"] + &[id$="_link_color"] { diff --git a/src/boldgrid-theme-framework.php b/src/boldgrid-theme-framework.php index e99288423..4a55edcf0 100644 --- a/src/boldgrid-theme-framework.php +++ b/src/boldgrid-theme-framework.php @@ -3,7 +3,7 @@ * Plugin Name: BoldGrid Theme Framework * Plugin URI: https://www.boldgrid.com/docs/configuration-file * Description: BoldGrid Theme Framework is a library that allows you to easily make BoldGrid themes. Please see our reference guide for more information: https://www.boldgrid.com/docs/configuration-file - * Version: 2.19.2 + * Version: 2.20.0 * Author: BoldGrid.com' + . esc_html__( 'Your header layout does not display a logo. ', 'crio' ) + . '' . esc_html__( 'Click Here', 'crio' ) + . ' ' . esc_html__( ' to display your logo.', 'crio' ) + . '
'; + } + /** * Get Branding Notices. * @@ -123,6 +138,11 @@ public function get_branding_notices() { . '' . esc_html__( 'Click Here', 'crio' ) . ' ' . esc_html__( ' to set your logo.', 'crio' ) . ''; + $markup .= '' + . esc_html__( 'Your header layout does not display a logo. ', 'crio' ) + . '' . esc_html__( 'Click Here', 'crio' ) + . ' ' . esc_html__( ' to display your logo.', 'crio' ) + . '
'; $markup .= '