diff --git a/docs/docs.js b/docs/docs.js index abd11a7d..6d700915 100644 --- a/docs/docs.js +++ b/docs/docs.js @@ -250,6 +250,26 @@ $("#showPaletteOnly").spectrum({ } }); +$("#showPaletteOnlyEmpty").spectrum({ + color: 'blanchedalmond', + showPaletteOnly: true, + showPalette:true, + palette: [ + ['black', 'white', 'blanchedalmond', 'violet'], + ['red', 'yellow', 'green', 'blue'] + ], + change: function(c) { + var label = $("[data-label-for=" + this.id + "]"); + label.text("Change called: " + (c ? c.toHexString() : "transparent")); + }, + move: function(c) { + var label = $("[data-label-for=" + this.id + "]"); + label.text("Move called: " + (c ? c.toHexString() : "transparent")); + }, + allowEmpty: true +}); + + $("#hideAfterPaletteSelect").spectrum({ showPaletteOnly: true, showPalette:true, diff --git a/index.html b/index.html index a9d800d9..b4a3e1c4 100644 --- a/index.html +++ b/index.html @@ -350,13 +350,23 @@

Show Palette Only

 $("#showPaletteOnly").spectrum({
     showPaletteOnly: true,
-    showPalette:true,
+    showPalette: true,
     color: 'blanchedalmond',
     palette: [
         ['black', 'white', 'blanchedalmond',
         'rgb(255, 128, 0);', 'hsv 100 70 50'],
         ['red', 'yellow', 'green', 'blue', 'violet']
     ]
+});
+$("#showPaletteOnlyEmpty").spectrum({
+    showPaletteOnly: true,
+    showPalette: true,
+    color: 'blanchedalmond',
+    palette: [
+        ['black', 'white', 'blanchedalmond', 'violet'],
+        ['red', 'yellow', 'green', 'blue']
+    ],
+    allowEmpty: true
 });
             
@@ -366,6 +376,10 @@

Show Palette Only

+
+ + +

Toggle Palette Only

diff --git a/spectrum.css b/spectrum.css index a8ad9e4f..2d606a11 100644 --- a/spectrum.css +++ b/spectrum.css @@ -102,7 +102,8 @@ License: MIT border: solid 1px #333; } -.sp-clear { +.sp-clear, +.sp-container .sp-clear-palette-only { display: none; } @@ -120,6 +121,20 @@ License: MIT height: 28px; } +.sp-clear-enabled.sp-palette-only .sp-clear-palette-only { + display: block; + position: static; + height: 16px; + margin: 3px 2px; + width: 16px; + + -webkit-box-shadow: inset 0 0 0 1px #ccc; + -moz-box-shadow: inset 0 0 0 1px #ccc; + -ms-box-shadow: inset 0 0 0 1px #ccc; + -o-box-shadow: inset 0 0 0 1px #ccc; + box-shadow: inset 0 0 0 1px #ccc; +} + /* Don't allow text selection */ .sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-clear, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button { -webkit-user-select:none; diff --git a/spectrum.js b/spectrum.js index e129e184..671a91e8 100644 --- a/spectrum.js +++ b/spectrum.js @@ -96,6 +96,7 @@ "
", "", "
", + "
", "", "
", "
",