Skip to content

Commit 28a19da

Browse files
committed
Improve web UI styling and accessibility
Piano keyboard: - Add 3D beveled black keys with gradient highlights and shadows - Fix black key positioning (right-aligned to white keys) - Improve white key styling with subtle shadows Header: - Style GitHub link as prominent button with icon - Add aria-hidden and focusable attributes to SVG Accessibility: - Add :focus-visible outlines for keyboard navigation - Add prefers-reduced-motion media query - Fix universal reset to include pseudo-elements
1 parent 76e07f0 commit 28a19da

File tree

3 files changed

+98
-10
lines changed

3 files changed

+98
-10
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ distclean: clean wasm-clean
9797
# Local development server
9898
serve: wasm
9999
@echo "Starting local server at http://127.0.0.1:8080"
100-
@cd $(WASM_DIR) && python3 -m http.server 8080
100+
@cd $(WASM_DIR) && python3 -m http.server 8080 --bind 127.0.0.1
101101

102102
# List available melodies
103103
list-melodies:

web/index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
<h1>PicoSynth</h1>
1313
<span class="subtitle">Lightweight software synthesizer</span>
1414
</div>
15-
<a href="https://github.com/sysprog21/picosynth" target="_blank" rel="noreferrer noopener">GitHub</a>
15+
<a href="https://github.com/sysprog21/picosynth" target="_blank" rel="noreferrer noopener" class="github-link">
16+
<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg>
17+
GitHub
18+
</a>
1619
</header>
1720

1821
<main>

web/style.css

Lines changed: 93 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
* { box-sizing: border-box; margin: 0; padding: 0; }
1+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
22

33
:root {
44
--bg: #1a1a2e;
@@ -37,6 +37,38 @@ header .subtitle {
3737
font-size: 0.9rem;
3838
}
3939

40+
header .github-link {
41+
margin-left: auto;
42+
display: inline-flex;
43+
align-items: center;
44+
gap: 6px;
45+
background: var(--border);
46+
color: var(--text);
47+
text-decoration: none;
48+
padding: 8px 14px;
49+
border-radius: 6px;
50+
border: 1px solid var(--primary);
51+
font-size: 0.9rem;
52+
font-weight: 500;
53+
transition: background-color 0.15s, color 0.15s, border-color 0.15s;
54+
}
55+
56+
header .github-link:focus-visible {
57+
outline: 2px solid var(--success);
58+
outline-offset: 2px;
59+
}
60+
61+
header .github-link:hover {
62+
background: var(--primary);
63+
color: var(--bg);
64+
}
65+
66+
header .github-link svg {
67+
width: 18px;
68+
height: 18px;
69+
fill: currentColor;
70+
}
71+
4072
main {
4173
max-width: 900px;
4274
margin: 0 auto;
@@ -61,29 +93,74 @@ main {
6193

6294
.key {
6395
cursor: pointer;
64-
transition: background 0.05s;
96+
transition: background-color 0.05s;
6597
user-select: none;
6698
}
6799

100+
.key:focus-visible {
101+
outline: 2px solid var(--success);
102+
outline-offset: 2px;
103+
z-index: 10;
104+
}
105+
68106
.key.white {
69107
width: 40px;
70108
height: 100%;
71-
background: linear-gradient(180deg, #fff 0%, #e8e8e8 100%);
72-
border: 1px solid #999;
109+
background: linear-gradient(180deg, #fff 0%, #f5f5f5 85%, #e0e0e0 100%);
110+
border: 1px solid #aaa;
73111
border-radius: 0 0 5px 5px;
74112
position: relative;
75113
z-index: 1;
114+
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
76115
}
77116

78117
.key.black {
79118
width: 24px;
80-
height: 60%;
81-
background: linear-gradient(180deg, #444 0%, #111 100%);
119+
height: 58%;
120+
background: linear-gradient(180deg,
121+
#555 0%,
122+
#444 2%,
123+
#333 5%,
124+
#222 20%,
125+
#1a1a1a 80%,
126+
#111 95%,
127+
#080808 100%);
82128
border: 1px solid #000;
129+
border-top: none;
83130
border-radius: 0 0 4px 4px;
84131
position: absolute;
85132
z-index: 2;
86-
margin-left: -12px;
133+
left: auto;
134+
right: -12px;
135+
box-shadow:
136+
-1px 0 0 #000,
137+
1px 0 0 #000,
138+
0 0 3px 1px rgba(0,0,0,0.5),
139+
0 4px 6px rgba(0,0,0,0.6),
140+
inset 0 -1px 2px rgba(255,255,255,0.05),
141+
inset 0 1px 0 rgba(80,80,80,0.3);
142+
}
143+
144+
.key.black::before {
145+
content: '';
146+
position: absolute;
147+
top: 0;
148+
left: 1px;
149+
right: 1px;
150+
height: 6px;
151+
background: linear-gradient(180deg, #777 0%, #555 40%, #333 100%);
152+
border-radius: 1px 1px 3px 3px;
153+
}
154+
155+
.key.black::after {
156+
content: '';
157+
position: absolute;
158+
top: 2px;
159+
left: 4px;
160+
right: 4px;
161+
height: 3px;
162+
background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
163+
border-radius: 2px;
87164
}
88165

89166
.key.white.active, .key.white:active {
@@ -193,7 +270,7 @@ button {
193270
padding: 8px 14px;
194271
font-size: 0.85rem;
195272
cursor: pointer;
196-
transition: all 0.15s;
273+
transition: background-color 0.15s, color 0.15s, border-color 0.15s;
197274
display: inline-flex;
198275
align-items: center;
199276
gap: 6px;
@@ -252,3 +329,11 @@ button:disabled {
252329
#status.ready { color: var(--success); }
253330
#status.error { color: #ff6b6b; }
254331
#status.playing { color: var(--primary); }
332+
333+
/* Accessibility: Reduced motion preference */
334+
@media (prefers-reduced-motion: reduce) {
335+
*, *::before, *::after {
336+
transition: none !important;
337+
animation: none !important;
338+
}
339+
}

0 commit comments

Comments
 (0)