Skip to content

Commit 49bd37b

Browse files
Tweak the delete button
So it doesn't look like "not allowed"
1 parent 055af05 commit 49bd37b

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

src/color-scale/color-scale.css

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ color-swatch {
2020
}
2121

2222
.color-name, input.color {
23-
--_border-color: var(--border-color, color-mix(in oklab, currentcolor 70%, oklab(none none none / 0%)));
23+
--_border-color: var(--border-color, color-mix(in oklab, buttonborder 70%, oklab(none none none / 0%)));
2424

2525
font: inherit;
2626
box-sizing: border-box;
@@ -34,32 +34,30 @@ color-swatch {
3434
}
3535

3636
.delete-button {
37+
--_foreground-color: red;
38+
--_background-color: white;
39+
3740
all: unset;
38-
position: absolute;
39-
inset-inline-end: .1em;
40-
inset-block-start: .3em;
4141

4242
display: grid;
4343
place-items: center;
4444
inline-size: 1.5em;
45-
padding: .2em;
4645
aspect-ratio: 1;
46+
padding: .2em;
4747

48-
font-size: 70%;
49-
line-height: 1;
50-
text-align: center;
48+
color: var(--_foreground-color);
49+
background-color: var(--_background-color);
5150

52-
border-radius: 50%;
53-
border: 1px solid color-mix(in oklab, currentcolor 20%, oklab(none none none / 0%));
51+
border-radius: .3em;
5452
box-shadow: 0 .05em 1em -.7em black;
55-
background-color: white;
5653

5754
cursor: pointer;
5855

59-
transition: transform .2s, opacity .2s;
56+
transition: opacity .2s;
6057

6158
&:is(:hover, :focus) {
62-
transform: scale(1.1);
59+
color: var(--_background-color);
60+
background-color: var(--_foreground-color);
6361
}
6462
}
6563
}

src/color-scale/color-scale.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,11 @@ const Self = class ColorScale extends ColorElement {
230230
if (this.editable.color) {
231231
// FIXME: What if there is content in the slots?
232232
html += `<input class="color editable" value="${ color }" />`;
233-
html += `<button slot="swatch-content" class="delete-button" title="Delete color">❌</button>`;
233+
html += `<button slot="swatch-content" class="delete-button" title="Delete color">
234+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
235+
<path fill="currentColor" fill-rule="evenodd" d="m18.412 6.5l-.801 13.617A2 2 0 0 1 15.614 22H8.386a2 2 0 0 1-1.997-1.883L5.59 6.5H3.5v-1A.5.5 0 0 1 4 5h16a.5.5 0 0 1 .5.5v1zM10 2.5h4a.5.5 0 0 1 .5.5v1h-5V3a.5.5 0 0 1 .5-.5M9 9l.5 9H11l-.4-9zm4.5 0l-.5 9h1.5l.5-9z" />
236+
</svg>
237+
</button>`;
234238
}
235239

236240
swatch.innerHTML = html;

0 commit comments

Comments
 (0)