gnome/extensions/dash-to-dock@micxgx.gmail.com/theming.js
/**
     * Reimported back and adapted from atomdock
     */
Reimported back and adapted from atomdock
Reimported back and adapted from atomdock
_adjustTheme() {
        if (!this._dash._container.get_stage())
            return;
        let settings = Docking.DockManager.settings;
        this._dash._container.set_style(null);
        this._transparency.disable();
        if (settings.get_boolean('apply-custom-theme'))
            return;
        let newStyle = '';
        let position = Utils.getPosition(settings);
        let themeNode = this._dash._container.get_theme_node();
        let borderColor = themeNode.get_border_color(St.Side.TOP);
        let borderWidth = themeNode.get_border_width(St.Side.TOP);
        let borderRadius = themeNode.get_border_radius(St.Corner.TOPRIGHT);
        let borderInner = '';
        let borderRadiusValue = '';
        let borderMissingStyle = '';
        if (this._rtl && (position != St.Side.RIGHT))
            borderMissingStyle = 'border-right: ' + borderWidth + 'px solid ' +
                   borderColor.to_string() + ';';
        else if (!this._rtl && (position != St.Side.LEFT))
            borderMissingStyle = 'border-left: ' + borderWidth + 'px solid ' +
                   borderColor.to_string() + ';';
        switch (position) {
        case St.Side.LEFT:
            borderInner = 'border-left';
            borderRadiusValue = '0 ' + borderRadius + 'px ' + borderRadius + 'px 0;';
            break;
        case St.Side.RIGHT:
            borderInner = 'border-right';
            borderRadiusValue = borderRadius + 'px 0 0 ' + borderRadius + 'px;';
            break;
        case St.Side.TOP:
            borderInner = 'border-top';
            borderRadiusValue = '0 0 ' + borderRadius + 'px ' + borderRadius + 'px;';
            break;
        case St.Side.BOTTOM:
            borderInner = 'border-bottom';
            borderRadiusValue = borderRadius + 'px ' + borderRadius + 'px 0 0;';
            break;
        }
        newStyle = borderInner + ': none;' +
            'border-radius: ' + borderRadiusValue +
            borderMissingStyle;
        this._dash._container.set_style(newStyle);
        let fixedTransparency = settings.get_enum('transparency-mode') == TransparencyMode.FIXED;
        let defaultTransparency = settings.get_enum('transparency-mode') == TransparencyMode.DEFAULT;
        if (!defaultTransparency && !fixedTransparency) {
            this._transparency.enable();
        }
        else if (!defaultTransparency || settings.get_boolean('custom-background-color')) {
            newStyle = newStyle + 'background-color:'+ this._customizedBackground + '; ' +
                       'border-color:'+ this._customizedBorder + '; ' +
                       'transition-delay: 0s; transition-duration: 0.250s;';
            this._dash._container.set_style(newStyle);
        }
    }
_adjustTheme ( ) { if ( ! this . _dash . _container . get_stage ( ) ) return ; let settings = Docking . DockManager . settings ; this . _dash . _container . set_style ( null ) ; this . _transparency . disable ( ) ; if ( settings . get_boolean ( 'apply-custom-theme' ) ) return ; let newStyle = '' ; let position = Utils . getPosition ( settings ) ; let themeNode = this . _dash . _container . get_theme_node ( ) ; let borderColor = themeNode . get_border_color ( St . Side . TOP ) ; let borderWidth = themeNode . get_border_width ( St . Side . TOP ) ; let borderRadius = themeNode . get_border_radius ( St . Corner . TOPRIGHT ) ; let borderInner = '' ; let borderRadiusValue = '' ; let borderMissingStyle = '' ; if ( this . _rtl && ( position != St . Side . RIGHT ) ) borderMissingStyle = 'border-right: ' + borderWidth + 'px solid ' + borderColor . to_string ( ) + ';' ; else if ( ! this . _rtl && ( position != St . Side . LEFT ) ) borderMissingStyle = 'border-left: ' + borderWidth + 'px solid ' + borderColor . to_string ( ) + ';' ; switch ( position ) { case St . Side . LEFT : borderInner = 'border-left' ; borderRadiusValue = '0 ' + borderRadius + 'px ' + borderRadius + 'px 0;' ; break ; case St . Side . RIGHT : borderInner = 'border-right' ; borderRadiusValue = borderRadius + 'px 0 0 ' + borderRadius + 'px;' ; break ; case St . Side . TOP : borderInner = 'border-top' ; borderRadiusValue = '0 0 ' + borderRadius + 'px ' + borderRadius + 'px;' ; break ; case St . Side . BOTTOM : borderInner = 'border-bottom' ; borderRadiusValue = borderRadius + 'px ' + borderRadius + 'px 0 0;' ; break ; } newStyle = borderInner + ': none;' + 'border-radius: ' + borderRadiusValue + borderMissingStyle ; this . _dash . _container . set_style ( newStyle ) ; let fixedTransparency = settings . get_enum ( 'transparency-mode' ) == TransparencyMode . FIXED ; let defaultTransparency = settings . get_enum ( 'transparency-mode' ) == TransparencyMode . DEFAULT ; if ( ! defaultTransparency && ! fixedTransparency ) { this . _transparency . enable ( ) ; } else if ( ! defaultTransparency || settings . get_boolean ( 'custom-background-color' ) ) { newStyle = newStyle + 'background-color:' + this . _customizedBackground + '; ' + 'border-color:' + this . _customizedBorder + '; ' + 'transition-delay: 0s; transition-duration: 0.250s;' ; this . _dash . _container . set_style ( newStyle ) ; } }
Reimported back and adapted from atomdock
Reimported back and adapted from atomdock
// Prevent shell crash if the actor is not on the stage. // It happens enabling/disabling repeatedly the extension // Remove prior style edits // If built-in theme is enabled do nothing else // obtain theme border settings // We're copying border and corner styles to left border and top-left // corner, also removing bottom border and bottom-right corner styles // I do call set_style possibly twice so that only the background gets the transition. // The transition-property css rules seems to be unsupported // Customize background