Skip to content

Commit 0fb0564

Browse files
committed
added sliders
1 parent b0c5386 commit 0fb0564

3 files changed

Lines changed: 304 additions & 14 deletions

File tree

css/grid.css

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,75 @@ h1 {
114114
gap: 8px;
115115
flex-wrap: wrap;
116116
}
117+
.tone-ramp-wrap {
118+
display: flex;
119+
align-items: center;
120+
gap: 10px;
121+
padding: 8px 10px;
122+
border: 1px solid var(--panel-border);
123+
border-radius: 4px;
124+
background: var(--panel-bg);
125+
}
126+
.tone-ramp-label {
127+
flex: 0 0 auto;
128+
font-size: 12px;
129+
color: var(--label);
130+
}
131+
.tone-ramp {
132+
display: flex;
133+
flex: 1;
134+
min-width: 0;
135+
gap: 4px;
136+
}
137+
.tone-ramp button {
138+
flex: 1;
139+
min-width: 0;
140+
height: 28px;
141+
border: 1px solid var(--swatch-item-border);
142+
border-radius: 3px;
143+
padding: 0;
144+
cursor: pointer;
145+
touch-action: manipulation;
146+
}
147+
.tone-ramp button[aria-selected="true"] {
148+
outline: 2px solid var(--select-outline);
149+
outline-offset: 2px;
150+
}
151+
.grid-sizing {
152+
display: flex;
153+
flex-wrap: wrap;
154+
gap: 10px 16px;
155+
padding: 8px 10px;
156+
border: 1px solid var(--panel-border);
157+
border-radius: 4px;
158+
background: var(--panel-bg);
159+
}
160+
.grid-sizing-label {
161+
display: flex;
162+
align-items: center;
163+
gap: 8px;
164+
flex: 1 1 180px;
165+
min-width: 0;
166+
font-size: 12px;
167+
color: var(--label);
168+
cursor: default;
169+
}
170+
.grid-sizing-label span {
171+
flex: 0 0 6.5em;
172+
}
173+
.grid-sizing-label input[type="range"] {
174+
flex: 1;
175+
min-width: 0;
176+
margin: 0;
177+
cursor: pointer;
178+
accent-color: #c0c0c0;
179+
}
180+
.grid-sizing-label output {
181+
flex: 0 0 2.5em;
182+
font-variant-numeric: tabular-nums;
183+
text-align: right;
184+
color: var(--muted);
185+
}
117186
.grid-wrap {
118187
width: 100%;
119188
aspect-ratio: 1;
@@ -132,11 +201,7 @@ table {
132201
user-select: none;
133202
-webkit-user-select: none;
134203
}
135-
tr {
136-
height: calc(100% / 24);
137-
}
138204
td {
139-
width: calc(100% / 24);
140205
padding: 0;
141206
border: 1px solid var(--cell-border);
142207
cursor: crosshair;

grid.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848
<symbol id="icon-square" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
4949
<rect width="18" height="18" x="3" y="3" rx="2"/>
5050
</symbol>
51+
<symbol id="icon-ramp" viewBox="0 0 24 24" fill="currentColor" stroke="none">
52+
<rect x="3" y="5" width="4" height="14" opacity="1"/>
53+
<rect x="10" y="5" width="4" height="14" opacity="0.55"/>
54+
<rect x="17" y="5" width="4" height="14" opacity="0.15"/>
55+
</symbol>
5156
<symbol id="icon-save" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
5257
<path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/>
5358
<path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"/>
@@ -99,6 +104,9 @@ <h1>Color Grid</h1>
99104
<button type="button" class="tool tool-icon" id="dropperBtn" aria-label="Pick color" title="Pick color" aria-expanded="false" aria-haspopup="dialog">
100105
<svg viewBox="0 0 24 24" aria-hidden="true"><use href="#icon-pipette"/></svg>
101106
</button>
107+
<button type="button" class="tool tool-icon" id="rampBtn" aria-pressed="false" aria-label="Ramp to black" title="Ramp to black — drag on grid">
108+
<svg viewBox="0 0 24 24" aria-hidden="true"><use href="#icon-ramp"/></svg>
109+
</button>
102110
<button type="button" class="tool tool-icon" id="eraserBtn" aria-pressed="false" aria-label="Eraser" title="Eraser">
103111
<svg viewBox="0 0 24 24" aria-hidden="true"><use href="#icon-eraser"/></svg>
104112
</button>
@@ -113,6 +121,22 @@ <h1>Color Grid</h1>
113121
</button>
114122
</div>
115123
</div>
124+
<div class="tone-ramp-wrap">
125+
<span class="tone-ramp-label">To black</span>
126+
<div class="tone-ramp" id="toneRamp" role="listbox" aria-label="Five steps from color to black"></div>
127+
</div>
128+
<div class="grid-sizing" aria-label="Silver grid sizing">
129+
<label class="grid-sizing-label">
130+
<span>Silver columns</span>
131+
<input type="range" id="silverColSize" min="0.25" max="3" step="0.05" value="1" aria-valuemin="0.25" aria-valuemax="3" aria-valuenow="1">
132+
<output id="silverColSizeVal" for="silverColSize"></output>
133+
</label>
134+
<label class="grid-sizing-label">
135+
<span>Silver rows</span>
136+
<input type="range" id="silverRowSize" min="0.25" max="3" step="0.05" value="1" aria-valuemin="0.25" aria-valuemax="3" aria-valuenow="1">
137+
<output id="silverRowSizeVal" for="silverRowSize"></output>
138+
</label>
139+
</div>
116140
</section>
117141
<section class="palette-panel">
118142
<section class="recent-section" aria-label="Recently used colors">

0 commit comments

Comments
 (0)