Skip to content

Commit 9601fbc

Browse files
committed
Font-preview: Fix colors
1 parent 792076b commit 9601fbc

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

github-font-preview.user.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name GitHub Font Preview
3-
// @version 1.0.24
3+
// @version 1.0.25
44
// @description A userscript that adds a font file preview
55
// @license MIT
66
// @author Rob Garrison
@@ -194,8 +194,8 @@
194194
#gfp-font-data .gfp-langname { padding-right:0.5em; }
195195
#gfp-font-data .gfp-underline { border-bottom:1px solid #555; }
196196
/* Glyph Inspector */
197-
#gfp-pagination span { margin:0 0.3em; cursor:pointer; }
198-
#gfp-pagination span.gfp-page-selected { font-weight:bold; cursor:default; -webkit-filter:brightness(150%); filter:brightness(150%); }
197+
#gfp-pagination a { margin:0 0.3em; cursor:pointer; }
198+
#gfp-pagination .gfp-page-selected { font-weight:bold; cursor:default; -webkit-filter:brightness(150%); filter:brightness(150%); }
199199
canvas.gfp-item { float:left; border:solid 1px #a0a0a0; margin-right:-1px; margin-bottom:-1px; cursor:pointer; }
200200
canvas.gfp-item:hover { opacity:.8; }
201201
#gfp-glyph-list-end { clear:both; height:20px; }
@@ -208,8 +208,8 @@
208208
#gfp-glyph-data pre { font-size:11px; }
209209
pre.gfp-path { margin:0; }
210210
pre.gfp-contour { margin:0 0 1em 2em; border-bottom:solid 1px #a0a0a0; }
211-
span.gfp-oncurve { color:blue; }
212-
span.gfp-offcurve { color:red; }
211+
span.gfp-oncurve { color:var(--color-scale-blue-6); }
212+
span.gfp-offcurve { color:var(--color-scale-red-6); }
213213
.gfp-loading { display:block; margin:20px auto; border-radius:50%; border-width:2px; border-style:solid; border-color: transparent transparent #000 #000; width:30px; height:30px; animation:gfploading .5s infinite linear; }
214214
@keyframes gfploading { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
215215
`);
@@ -330,9 +330,7 @@
330330

331331
function contourToString(contour) {
332332
return '<pre class="gfp-contour">' + contour.map(point => {
333-
// ".text-blue" class modified by GitHub Dark style
334-
// ".cdel" class modified by GitHub Dark style - more readable red
335-
return '<span class="gfp-' + (point.onCurve ? 'oncurve text-blue' : 'offcurve cdel') +
333+
return '<span class="gfp-' + (point.onCurve ? 'oncurve' : 'offcurve') +
336334
'">x=' + point.x + ' y=' + point.y + '</span>';
337335
}).join('\n') + '</pre>';
338336
}
@@ -532,6 +530,8 @@
532530

533531
function displayGlyphPage(pageNum) {
534532
pageSelected = pageNum;
533+
const last = $('.gfp-page-selected');
534+
if (last) last.className = '';
535535
document.getElementById('gfp-p' + pageNum).className = 'gfp-page-selected';
536536
let indx,
537537
firstGlyph = pageNum * cellCount;
@@ -541,7 +541,6 @@
541541
}
542542

543543
function pageSelect(event) {
544-
document.getElementsByClassName('gfp-page-selected')[0].className = 'text-blue';
545544
displayGlyphPage((event.target.id || '').replace('gfp-p', ''));
546545
}
547546

@@ -592,11 +591,10 @@
592591
pagination.innerHTML = '';
593592

594593
for (indx = 0; indx < numPages; indx++) {
595-
link = document.createElement('span');
594+
link = document.createElement('a');
596595
lastIndex = Math.min(font.numGlyphs - 1, (indx + 1) * cellCount - 1);
597596
link.textContent = indx * cellCount + '-' + lastIndex;
598597
link.id = 'gfp-p' + indx;
599-
link.className = 'text-blue';
600598
link.addEventListener('click', pageSelect, false);
601599
fragment.appendChild(link);
602600
// A white space allows to break very long lines into multiple lines.

0 commit comments

Comments
 (0)