Spaces:
Running
Running
Commit ·
4fb4554
1
Parent(s): 9fb0d40
refined score player styles.
Browse files- web/score-player.css +12 -0
- web/score-player.js +2 -2
web/score-player.css
CHANGED
|
@@ -28,6 +28,12 @@
|
|
| 28 |
|
| 29 |
.ls-svg {
|
| 30 |
background: #fff;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
display: inline-block;
|
| 32 |
min-width: 100%;
|
| 33 |
}
|
|
@@ -35,6 +41,12 @@
|
|
| 35 |
max-width: 100%;
|
| 36 |
height: auto;
|
| 37 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
/* playing-note highlight on the SVG */
|
| 40 |
.ls-hl {
|
|
|
|
| 28 |
|
| 29 |
.ls-svg {
|
| 30 |
background: #fff;
|
| 31 |
+
/* Verovio draws staff lines / notes with stroke|fill="currentColor", which
|
| 32 |
+
inherits the CSS `color`. Gradio's dark theme sets a light body color (with
|
| 33 |
+
enough specificity to beat a plain class rule), so the score would render as
|
| 34 |
+
pale lines on the white box. Force a dark ink color with !important so it
|
| 35 |
+
holds regardless of the active Gradio theme. */
|
| 36 |
+
color: #1a1a1a !important;
|
| 37 |
display: inline-block;
|
| 38 |
min-width: 100%;
|
| 39 |
}
|
|
|
|
| 41 |
max-width: 100%;
|
| 42 |
height: auto;
|
| 43 |
}
|
| 44 |
+
/* Belt-and-suspenders: pin currentColor on the actual drawing elements too. */
|
| 45 |
+
.ls-svg svg .staff path,
|
| 46 |
+
.ls-svg svg .barLine path,
|
| 47 |
+
.ls-svg svg .ledgerLines path {
|
| 48 |
+
stroke: #1a1a1a;
|
| 49 |
+
}
|
| 50 |
|
| 51 |
/* playing-note highlight on the SVG */
|
| 52 |
.ls-hl {
|
web/score-player.js
CHANGED
|
@@ -119,7 +119,7 @@
|
|
| 119 |
try {
|
| 120 |
const { mei, measureCount, staffCount } = lylToMei(code);
|
| 121 |
const pageHeight = Math.max(2000, Math.ceil(measureCount / 20) * 2000) * 2 * staffCount;
|
| 122 |
-
tk.setOptions({ scale: 40, adjustPageHeight: true, pageWidth: 2100, pageHeight });
|
| 123 |
if (!tk.loadData(mei)) { setStatus('Verovio load failed', 'err'); return false; }
|
| 124 |
injectSvg(tk.renderToSVG(1));
|
| 125 |
state.lastCode = code;
|
|
@@ -336,7 +336,7 @@
|
|
| 336 |
|
| 337 |
root.appendChild(wrap); root.appendChild(player);
|
| 338 |
|
| 339 |
-
els.root = root; els.svg = svgBox; els.status = status; els.player = player;
|
| 340 |
els.playBtn = player.querySelector('.ls-play');
|
| 341 |
els.pauseBtn = player.querySelector('.ls-pause');
|
| 342 |
els.stopBtn = player.querySelector('.ls-stop');
|
|
|
|
| 119 |
try {
|
| 120 |
const { mei, measureCount, staffCount } = lylToMei(code);
|
| 121 |
const pageHeight = Math.max(2000, Math.ceil(measureCount / 20) * 2000) * 2 * staffCount;
|
| 122 |
+
tk.setOptions({ scale: 40, adjustPageHeight: true, pageWidth: 2100, pageHeight: pageHeight });
|
| 123 |
if (!tk.loadData(mei)) { setStatus('Verovio load failed', 'err'); return false; }
|
| 124 |
injectSvg(tk.renderToSVG(1));
|
| 125 |
state.lastCode = code;
|
|
|
|
| 336 |
|
| 337 |
root.appendChild(wrap); root.appendChild(player);
|
| 338 |
|
| 339 |
+
els.root = root; els.svg = svgBox; els.preview = wrap; els.status = status; els.player = player;
|
| 340 |
els.playBtn = player.querySelector('.ls-play');
|
| 341 |
els.pauseBtn = player.querySelector('.ls-pause');
|
| 342 |
els.stopBtn = player.querySelector('.ls-stop');
|