Adwaita: colorpicker fixes.
authorLapo Calamandrei <calamandrei@gmail.com>
Thu, 16 Apr 2015 07:57:23 +0000 (09:57 +0200)
committerLapo Calamandrei <calamandrei@gmail.com>
Thu, 16 Apr 2015 07:59:45 +0000 (09:59 +0200)
Added another :not() to fix the first and last swatches in the
first section of colorpicker.
Dodge the artifacts due to stacked anti-aliased rounded corners by
increasing the radius of the base object by 1px.

gtk/theme/Adwaita/_common.scss
gtk/theme/Adwaita/gtk-contained-dark.css
gtk/theme/Adwaita/gtk-contained.css

index 447309213adeb489969791603bbb9597efb830a0..34fc60255deab1c65307f30eb1d9a730cdb5ebe9 100644 (file)
@@ -816,7 +816,7 @@ $_dot_color: if($variant=='light', $selected_bg_color,
 GtkColorButton.button {
   padding: 5px; // Uniform padding on the GtkColorButton
 
-  GtkColorSwatch:first-child:last-child { // :first-child:last-child for a specificity bump, it gets overridden by the 
+  GtkColorSwatch:first-child:last-child { // :first-child:last-child for a specificity bump, it gets overridden by the
                                           // colorpicker style, otherwise
     border-radius: 0;
     box-shadow: inset 0 1px 1px transparentize(black, 0.9),
@@ -3094,6 +3094,8 @@ GtkColorSwatch {
 
   $_colorswatch_shadow: inset 0 1px transparentize(black, 0.9), _widget_edge();
 
+  $_colorswatch_radius: 5px;
+
   box-shadow: $_colorswatch_shadow;
 
   // take care of colorswatches on selected elements
@@ -3107,27 +3109,48 @@ GtkColorSwatch {
   // we need to re-set the shadow here since it get axed by the previous bit
   &:selected { box-shadow: $_colorswatch_shadow; }
 
-  // border rounding
+  // base color corners rounding
+  // to avoid the artifacts caused by rounded corner anti-aliasing the base color
+  // sports a bigger radius.
+  // nth-child is needed by the custom color strip.
+  // The :not() madness is needed since actually the overlay is selectable by GtkColorSwatch > .overlay
+  // and GtkColorSwatch.overlay, I know it's weird, but this is gtk+, not a browser.
   &.top {
-    border-top-left-radius: 5px;
-    border-top-right-radius: 5px;
+    border-top-left-radius: $_colorswatch-radius + 1px;
+    border-top-right-radius: $_colorswatch-radius + 1px;
   }
   &.bottom {
-    border-bottom-left-radius: 5px;
-    border-bottom-right-radius: 5px;
+    border-bottom-left-radius: $_colorswatch-radius + 1px;
+    border-bottom-right-radius: $_colorswatch-radius + 1px;
   }
-  &.left, &:first-child:not(.overlay), &:first-child:not(.top) > .overlay {
-    border-top-left-radius: 5px;
-    border-bottom-left-radius: 5px;
+  &.left, &:first-child:not(.overlay):not(.top) {
+    border-top-left-radius: $_colorswatch-radius + 1px;
+    border-bottom-left-radius: $_colorswatch-radius + 1px;
   }
-  &.right, &:last-child:not(.overlay), &:last-child:not(.bottom) > .overlay {
-    border-top-right-radius: 5px;
-    border-bottom-right-radius: 5px;
+  &.right, &:last-child:not(.overlay):not(.bottom) {
+    border-top-right-radius: $_colorswatch-radius + 1px;
+    border-bottom-right-radius: $_colorswatch-radius + 1px;
   }
-  &:only-child:not(.overlay), &:only-child > .overlay { border-radius: 5px; }
-  // nth-child is used for the custom colors row.
-  // the :not() madness is needed since actually the overlay is selectable by GtkColorSwatch > .overlay
-  // and GtkColorSwatch.overlay, I know it's weird, but this is gtk+.
+  &:only-child:not(.overlay) { border-radius: $_colorswatch-radius + 1px; }
+
+  // overlay corner rounding
+  &.top > .overlay {
+    border-top-left-radius: $_colorswatch-radius;
+    border-top-right-radius: $_colorswatch-radius;
+  }
+  &.bottom > .overlay {
+    border-bottom-left-radius: $_colorswatch-radius;
+    border-bottom-right-radius: $_colorswatch-radius;
+  }
+  &:first-child:not(.top) > .overlay {
+    border-top-left-radius: $_colorswatch-radius;
+    border-bottom-left-radius: $_colorswatch-radius;
+  }
+  &:last-child:not(.bottom) > .overlay {
+    border-top-right-radius: $_colorswatch-radius;
+    border-bottom-right-radius: $_colorswatch-radius;
+  }
+  &:only-child > .overlay { border-radius: $_colorswatch-radius; }
 
   // hover effect
   &:hover,
@@ -3136,9 +3159,15 @@ GtkColorSwatch {
                                               transparentize(white, 1) 50%);
     box-shadow: inset 0 1px transparentize(white, 0.6),
                 inset 0 -1px if($variant == 'light', transparentize(black, 0.9), transparentize(black, 0.6));
+    &.color-dark { // swatches with colors with luminosity lower than 50% get the color-dark class
+      background-image: linear-gradient(135deg, transparentize(white, 0.5),
+                                                transparentize(white, 1) 50%);
+    }
   }
   &:backdrop,
-  &:backdrop:selected {
+  &:backdrop:selected
+  &.color-dark:backdrop,
+  &.color-dark:backdrop:selected {
     background-image: none;
     box-shadow: none;
   }
@@ -3153,7 +3182,7 @@ GtkColorSwatch {
     &:backdrop { box-shadow: none; }
   }
 
-  // indicator and keynav outline colors, color-dark is a color with luminosity lower then 50%
+  // indicator and keynav outline colors
   &.color-dark {
     color: white;
     outline-color: transparentize(black, 0.7);
@@ -3323,7 +3352,7 @@ GtkVolumeButton.button { padding: 8px; }
 }
 
 // Overflow indication, works similarly to the overshoot, the size if fixed tho.
-.undershoot { 
+.undershoot {
   &.top {
     @include undershoot(top);
   }
index 4e3992227923e00bc835161739a5880285902c70..afa2610d1460dbebdbba09e651c279db8274df98 100644 (file)
@@ -4238,23 +4238,40 @@ GtkColorSwatch {
   GtkColorSwatch:selected {
     box-shadow: inset 0 1px rgba(0, 0, 0, 0.1), 0 1px rgba(238, 238, 236, 0.1); }
   GtkColorSwatch.top {
+    border-top-left-radius: 6px;
+    border-top-right-radius: 6px; }
+  GtkColorSwatch.bottom {
+    border-bottom-left-radius: 6px;
+    border-bottom-right-radius: 6px; }
+  GtkColorSwatch.left, GtkColorSwatch:first-child:not(.overlay):not(.top) {
+    border-top-left-radius: 6px;
+    border-bottom-left-radius: 6px; }
+  GtkColorSwatch.right, GtkColorSwatch:last-child:not(.overlay):not(.bottom) {
+    border-top-right-radius: 6px;
+    border-bottom-right-radius: 6px; }
+  GtkColorSwatch:only-child:not(.overlay) {
+    border-radius: 6px; }
+  GtkColorSwatch.top > .overlay {
     border-top-left-radius: 5px;
     border-top-right-radius: 5px; }
-  GtkColorSwatch.bottom {
+  GtkColorSwatch.bottom > .overlay {
     border-bottom-left-radius: 5px;
     border-bottom-right-radius: 5px; }
-  GtkColorSwatch.left, GtkColorSwatch:first-child:not(.overlay), GtkColorSwatch:first-child:not(.top) > .overlay {
+  GtkColorSwatch:first-child:not(.top) > .overlay {
     border-top-left-radius: 5px;
     border-bottom-left-radius: 5px; }
-  GtkColorSwatch.right, GtkColorSwatch:last-child:not(.overlay), GtkColorSwatch:last-child:not(.bottom) > .overlay {
+  GtkColorSwatch:last-child:not(.bottom) > .overlay {
     border-top-right-radius: 5px;
     border-bottom-right-radius: 5px; }
-  GtkColorSwatch:only-child:not(.overlay), GtkColorSwatch:only-child > .overlay {
+  GtkColorSwatch:only-child > .overlay {
     border-radius: 5px; }
   GtkColorSwatch:hover, GtkColorSwatch:hover:selected {
     background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 50%);
     box-shadow: inset 0 1px rgba(255, 255, 255, 0.4), inset 0 -1px rgba(0, 0, 0, 0.4); }
-  GtkColorSwatch:backdrop, GtkColorSwatch:backdrop:selected {
+    GtkColorSwatch:hover.color-dark, GtkColorSwatch:hover:selected.color-dark {
+      background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 50%); }
+  GtkColorSwatch:backdrop, GtkColorSwatch:backdrop:selected
+  GtkColorSwatch.color-dark:backdrop, GtkColorSwatch.color-dark:backdrop:selected {
     background-image: none;
     box-shadow: none; }
   GtkColorEditor GtkColorSwatch {
index 1d5dbe2cb177126b181c1d8f8122fd87b05389b5..e6e3584a0805787f633cb2c948e4da3a26cb303c 100644 (file)
@@ -4410,23 +4410,40 @@ GtkColorSwatch {
   GtkColorSwatch:selected {
     box-shadow: inset 0 1px rgba(0, 0, 0, 0.1), 0 1px white; }
   GtkColorSwatch.top {
+    border-top-left-radius: 6px;
+    border-top-right-radius: 6px; }
+  GtkColorSwatch.bottom {
+    border-bottom-left-radius: 6px;
+    border-bottom-right-radius: 6px; }
+  GtkColorSwatch.left, GtkColorSwatch:first-child:not(.overlay):not(.top) {
+    border-top-left-radius: 6px;
+    border-bottom-left-radius: 6px; }
+  GtkColorSwatch.right, GtkColorSwatch:last-child:not(.overlay):not(.bottom) {
+    border-top-right-radius: 6px;
+    border-bottom-right-radius: 6px; }
+  GtkColorSwatch:only-child:not(.overlay) {
+    border-radius: 6px; }
+  GtkColorSwatch.top > .overlay {
     border-top-left-radius: 5px;
     border-top-right-radius: 5px; }
-  GtkColorSwatch.bottom {
+  GtkColorSwatch.bottom > .overlay {
     border-bottom-left-radius: 5px;
     border-bottom-right-radius: 5px; }
-  GtkColorSwatch.left, GtkColorSwatch:first-child:not(.overlay), GtkColorSwatch:first-child:not(.top) > .overlay {
+  GtkColorSwatch:first-child:not(.top) > .overlay {
     border-top-left-radius: 5px;
     border-bottom-left-radius: 5px; }
-  GtkColorSwatch.right, GtkColorSwatch:last-child:not(.overlay), GtkColorSwatch:last-child:not(.bottom) > .overlay {
+  GtkColorSwatch:last-child:not(.bottom) > .overlay {
     border-top-right-radius: 5px;
     border-bottom-right-radius: 5px; }
-  GtkColorSwatch:only-child:not(.overlay), GtkColorSwatch:only-child > .overlay {
+  GtkColorSwatch:only-child > .overlay {
     border-radius: 5px; }
   GtkColorSwatch:hover, GtkColorSwatch:hover:selected {
     background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 50%);
     box-shadow: inset 0 1px rgba(255, 255, 255, 0.4), inset 0 -1px rgba(0, 0, 0, 0.1); }
-  GtkColorSwatch:backdrop, GtkColorSwatch:backdrop:selected {
+    GtkColorSwatch:hover.color-dark, GtkColorSwatch:hover:selected.color-dark {
+      background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 50%); }
+  GtkColorSwatch:backdrop, GtkColorSwatch:backdrop:selected
+  GtkColorSwatch.color-dark:backdrop, GtkColorSwatch.color-dark:backdrop:selected {
     background-image: none;
     box-shadow: none; }
   GtkColorEditor GtkColorSwatch {