From 9d91b586d8bdf07a98c2d9fc0f21a2c99df32409 Mon Sep 17 00:00:00 2001 From: nana-4 Date: Sat, 25 Jan 2020 11:37:16 +0900 Subject: [PATCH] theme: Remove unnecessary !important rules Using !important is a bad practice and should be avoided wherever possible to make styling and debugging easier. See: https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity#The_!important_exception https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/957 --- data/theme/gnome-shell-sass/_drawing.scss | 8 ++++---- data/theme/gnome-shell-sass/widgets/_app-grid.scss | 9 ++++----- data/theme/gnome-shell-sass/widgets/_calendar.scss | 8 ++++---- data/theme/gnome-shell-sass/widgets/_dash.scss | 7 +++---- data/theme/gnome-shell-sass/widgets/_keyboard.scss | 4 ++-- data/theme/gnome-shell-sass/widgets/_popovers.scss | 3 +-- data/theme/gnome-shell-sass/widgets/_search-results.scss | 4 +--- .../gnome-shell-sass/widgets/_workspace-switcher.scss | 8 ++++---- 8 files changed, 23 insertions(+), 28 deletions(-) diff --git a/data/theme/gnome-shell-sass/_drawing.scss b/data/theme/gnome-shell-sass/_drawing.scss index 3afacea67..44323b3ce 100644 --- a/data/theme/gnome-shell-sass/_drawing.scss +++ b/data/theme/gnome-shell-sass/_drawing.scss @@ -137,7 +137,7 @@ // normal button @if $t==normal { color: $tc; - background-color: lighten($c, 3%) !important; + background-color: lighten($c, 3%); border-color: draw_border_color($c); @include draw_shadows($button_shadow); // box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1); @@ -157,7 +157,7 @@ // hover button @else if $t==hover { color: $tc; - background-color: lighten($c, if($variant == 'light', 8%, 5%)) !important; + background-color: lighten($c, if($variant == 'light', 8%, 5%)); border-color: if($variant == 'light', draw_border_color(lighten($c, 7%)), draw_border_color($c)); @include draw_shadows($button_shadow); text-shadow: 0 1px $text_shadow_color; @@ -167,7 +167,7 @@ // active button @else if $t==active { color: $tc; - background-color: darken($c,3%) !important; + background-color: darken($c,3%); border-color: draw_border_color(if($variant == 'light', $c, darken($c,7%))); text-shadow: none; icon-shadow: none; @@ -178,7 +178,7 @@ @else if $t==insensitive { color: $insensitive_fg_color; border-color: $insensitive_borders_color; - background-color: $insensitive_bg_color !important; + background-color: $insensitive_bg_color; box-shadow: none; text-shadow: none; icon-shadow: none; diff --git a/data/theme/gnome-shell-sass/widgets/_app-grid.scss b/data/theme/gnome-shell-sass/widgets/_app-grid.scss index e8736dd6c..e3e289d8a 100644 --- a/data/theme/gnome-shell-sass/widgets/_app-grid.scss +++ b/data/theme/gnome-shell-sass/widgets/_app-grid.scss @@ -37,7 +37,7 @@ $app_grid_fg_color: #fff; .overview-icon { @extend %icon_tile; - color: $app_grid_fg_color !important; + color: $app_grid_fg_color; } &:selected { @@ -58,7 +58,7 @@ $app_grid_fg_color: #fff; &:focus { .overview-icon { - background-color: transparentize($osd_fg_color,0.7 ); + background-color: transparentize($osd_fg_color,0.7); // border-color: $selected_bg_color; color: $app_grid_fg_color; } @@ -203,13 +203,12 @@ $app_grid_fg_color: #fff; // buttons .app-view-control { - padding: 4px 32px; margin: 0 4px; + &, &:hover, &:checked { @include button(undecorated); color: darken($osd_fg_color, 25%); - background-color: transparent !important; } &:hover { @@ -232,6 +231,6 @@ $app_grid_fg_color: #fff; } &:last-child { - border-radius: 0; + border-radius: 0; } } diff --git a/data/theme/gnome-shell-sass/widgets/_calendar.scss b/data/theme/gnome-shell-sass/widgets/_calendar.scss index 8ba3d63c2..0331dd33f 100644 --- a/data/theme/gnome-shell-sass/widgets/_calendar.scss +++ b/data/theme/gnome-shell-sass/widgets/_calendar.scss @@ -49,9 +49,9 @@ // calendar .calendar { @extend %notification_bubble; - margin:$base_margin !important; - margin-bottom: $base_padding + $base_margin !important; - padding:$base_padding !important; + margin: $base_margin; + margin-bottom: $base_padding + $base_margin; + padding: $base_padding; // more below for sub-elements } @@ -68,7 +68,7 @@ .world-clocks-button, .weather-button { @extend %notification_bubble; - padding:$base_padding !important; + padding: $base_padding; } } } diff --git a/data/theme/gnome-shell-sass/widgets/_dash.scss b/data/theme/gnome-shell-sass/widgets/_dash.scss index 9956a1ad5..8de114b59 100644 --- a/data/theme/gnome-shell-sass/widgets/_dash.scss +++ b/data/theme/gnome-shell-sass/widgets/_dash.scss @@ -9,12 +9,11 @@ $dash_border_radius: $modal_radius * 1.5; @include fontsize($base_font_size - 2); padding: ($dash_spacing / 2) 0; - //fixme: can't have non uniform borders :( border-radius: 0 $dash_border_radius $dash_border_radius 0; - border-left-width: 0 !important; - &:rtl { + border-left-width: 0; + &:rtl { border-radius: $dash_border_radius 0 0 $dash_border_radius; - border-right-width: 0 !important; + border-right-width: 0; } .placeholder { diff --git a/data/theme/gnome-shell-sass/widgets/_keyboard.scss b/data/theme/gnome-shell-sass/widgets/_keyboard.scss index 2f3678b03..1842ebe0d 100644 --- a/data/theme/gnome-shell-sass/widgets/_keyboard.scss +++ b/data/theme/gnome-shell-sass/widgets/_keyboard.scss @@ -10,7 +10,7 @@ $default_key_bg_color: if($variant=='light', darken($osd_bg_color, 11%), lighten // draw keys using button function #keyboard { background-color: transparentize(if($variant=='light', darken($bg_color, 5%), darken($bg_color, 8%)), 0.1); - box-shadow: inset 0 1px 0 0 $osd_outer_borders_color !important; + box-shadow: inset 0 1px 0 0 $osd_outer_borders_color; .page-indicator { padding: $base_padding; @@ -121,4 +121,4 @@ $default_key_bg_color: if($variant=='light', darken($osd_bg_color, 11%), lighten @include fontsize($base_font_size + 3); spacing: 12px; min-height: 20pt; -} \ No newline at end of file +} diff --git a/data/theme/gnome-shell-sass/widgets/_popovers.scss b/data/theme/gnome-shell-sass/widgets/_popovers.scss index f0c87e19a..e45649899 100644 --- a/data/theme/gnome-shell-sass/widgets/_popovers.scss +++ b/data/theme/gnome-shell-sass/widgets/_popovers.scss @@ -87,7 +87,6 @@ $popover_arrow_height: 12px; height: 1px; //not really the whole box margin: 6px 64px; background-color: lighten($borders_color, 2%); - border: none !important; } // desktop background menu @@ -118,4 +117,4 @@ $popover_arrow_height: 12px; margin-right: $base_icon_size; } } -} \ No newline at end of file +} diff --git a/data/theme/gnome-shell-sass/widgets/_search-results.scss b/data/theme/gnome-shell-sass/widgets/_search-results.scss index 15a9ee0a0..600aa83bc 100644 --- a/data/theme/gnome-shell-sass/widgets/_search-results.scss +++ b/data/theme/gnome-shell-sass/widgets/_search-results.scss @@ -8,8 +8,6 @@ // search results sections "the boxes" .search-section { spacing: $base_margin * 2; - padding:0 !important; - margin:0 !important; background-color:transparent; box-shadow:none; border:none; @@ -118,7 +116,7 @@ padding: $base_padding; color: $osd_fg_color; - border-radius: $base_border_radius + 2px !important; + border-radius: $base_border_radius + 2px; &:focus, &:selected, diff --git a/data/theme/gnome-shell-sass/widgets/_workspace-switcher.scss b/data/theme/gnome-shell-sass/widgets/_workspace-switcher.scss index f3a227087..a6ea83adc 100644 --- a/data/theme/gnome-shell-sass/widgets/_workspace-switcher.scss +++ b/data/theme/gnome-shell-sass/widgets/_workspace-switcher.scss @@ -45,11 +45,11 @@ padding: $base_padding; border-radius: $modal_radius 0 0 $modal_radius; - border-right-width: 0 !important; + border-right-width: 0; - &:rtl { + &:rtl { border-radius: 0 $modal_radius $modal_radius 0; - border-left-width: 0 !important; + border-left-width: 0; } // drag and drop indicator @@ -66,4 +66,4 @@ border-radius: 3px; padding: 0px; // background-color: transparentize($selected_bg_color, 0.9); -} \ No newline at end of file +}