Code
import os
from IPython.display import HTML, display
folder = "arms"
svgs = sorted([f for f in os.listdir(folder) if f.endswith(".svg")])
html = """
<style>
.gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 1rem;
}
.card {
text-align: center;
cursor: pointer;
}
.card img {
height: 200px;
transition: transform 0.2s ease;
}
.card img:hover {
transform: scale(1.05);
}
/* Lightbox */
.lightbox {
display: none;
position: fixed;
z-index: 9999;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.85);
align-items: center;
justify-content: center;
}
.lightbox img {
max-width: 90%;
max-height: 90%;
}
</style>
<div class="gallery">
"""
for svg in svgs:
title = os.path.splitext(svg)[0].replace("_", " ")
path = f"{folder}/{svg}"
html += f"""
<div class="card" onclick="openLightbox('{path}')">
<img src="{path}">
<div>{title}</div>
</div>
"""
html += """
</div>
<div id="lightbox" class="lightbox" onclick="closeLightbox()">
<img id="lightbox-img">
</div>
<script>
function openLightbox(src) {
document.getElementById('lightbox-img').src = src;
document.getElementById('lightbox').style.display = 'flex';
}
function closeLightbox() {
document.getElementById('lightbox').style.display = 'none';
document.getElementById('lightbox-img').src = '';
}
document.addEventListener('keydown', function(e) {
if (e.key === "Escape") closeLightbox();
});
</script>
"""
display(HTML(html))ABERISKA
ABERLUNE
ABONA
AYR
Abertamari
Aberteifi
Abertyui
Aedmondsbury
Aghaidh Mhor
Aida
Alawyk
Arbury
Avesbury
BREADHAIG
Bhoid
Bhrothaig
Bjorrton
Blaecaly
Boerthaldon
Breidford
Bridgeton
BrynyBeddau
BrynyMoch
Buellt
Byggwyk
CAERTADD
CANTIABURY
CELMFORD
CONNAGHYN
CYNWY
Caer Morglawdd
Caerblaidd
Caereustace
Caerferes
Caerguiragon
Caerllweydd
Caerloyw
Cairnryan
Canvey
Carneluk
Chatnaich
Cor Gybi
Corby
Corinium
Cotystone
Craoibh
Croesi Arth
Crowly
DEORABY
DEVERDOEU
DUNHELM
DUN DEAGH
DUN EIDYNN
Dourmouth
Duansborough
Dun Barra
Dun Bhlathain
Dun Cambel
Dun Douglas
Dun Drennan
Dun Fraser
Dun Patrick
Dun Pharlain
Duniness
Dunn Kiliwhimin
Dunwyk
Durnovara
Dyrh
Ecclesbrith
Elmbridge
GARSCADDEN
GREATMINSTER
GYPPESWYK
Gegnesborough
Ghlinn Sidh
Gifl
Gildenborough
Glanfa Llyffant
Gransthrop
Gwinwr
Gwrexham
Haesta
Harbwr Gwyn
Harhenhall
Hedgeward
Hen Sarum
Henffordd
Hiccin
Horgrsgate
Huntaton
Hvitby
INBHIRDHEATH
INBHIRNESS
Inbhirleith
Inbhirora
Isly
JORVALE
Jetborough
Kilrymont
Kingsbrook
Konigsby
LINDIS
Laminton
Leargaidh
Llangurroc
Llanllieni
Lockardsby
Loidis
Lunn
Malew
Manceinion
Marlbury
Marnock
Middleton
Mootburne
Morgate
Mortdunum
NANTYBRENIN
NORTHOME
NORWYK
Narann
Nivenhall
Notingborough
PORTHENNOR
Pen Maelor
Penbedw
Pengwern
Pensanctaidd
Pitloch Atholl
Pont Myrddin
Rathais
Raudmarsh
Redhill
Rheradr
Rhyddrwg
Rhydychen
Rigg
Rivenhall
Roiton
Rypon
Saesmond
Selsbrith
Sgain
Silford
Silverton
Skaggisness
Skardaborough
Skaw
Skirbeck
Skumasthorp
Soarcester
Southminster
Southome
Speldhall
Stamborough
Tairafon
Tandridge
Theoford
Thraepston
Thulnain
Torksey
Treffynnon
Trefgofannon
Trefoffeiriad
Treftone
Trefvenydh
Ty Cerrig
Tynron Doon
UXBRIDGE
Vodinnsmere
Vodinnswyk
WAERICK
Waecia
Wallsend
Wealderton
Windle
Winford
Wyke
Wysg
Yarm
Ynys Wydr