Added Dual Line mode to better support Dark mode
Inspired by https://github.com/LukaHarambasic/bookmark-divider
This commit is contained in:
parent
c872d67aed
commit
9954c1172f
16
index.html
16
index.html
|
@ -60,7 +60,9 @@
|
|||
<label for="style" class="block text-sm font-medium text-gray-700">Style</label>
|
||||
<select name="style" class="mt-1 block w-full rounded-md border border-gray-300 bg-white py-2 px-3 shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 sm:text-sm" required>
|
||||
<option value="vertical">Vertical Bar</option>
|
||||
<option value="v2">Vertical Dual Bar</option>
|
||||
<option value="horizontal">Horizontal Bar</option>
|
||||
<option value="h2">Horizontal Dual Bar</option>
|
||||
<option value="circle">Circle</option>
|
||||
</select>
|
||||
</div>
|
||||
|
@ -71,6 +73,7 @@
|
|||
<div class="col-span-6">
|
||||
<label for="color" class="block text-sm font-medium text-gray-700">Color</label>
|
||||
<input type="text" name="color" placeholder="HEX, RGB(A), CSS Color Names" class="mt-1 block w-full rounded-md border border-gray-300 bg-white py-2 px-3 shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 sm:text-sm" required>
|
||||
<input type="text" name="color2" placeholder="HEX, RGB(A), CSS Color Names" class="mt-1 block w-full rounded-md border border-gray-300 bg-white py-2 px-3 shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 sm:text-sm" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -96,15 +99,20 @@
|
|||
p = new URLSearchParams(window.location.search),
|
||||
o = p.get('style'),
|
||||
c = p.get('color'),
|
||||
w = p.get('width'),
|
||||
l = `<line ${ o === 'vertical' ? 'x1="8" x2="8" y1="0" y2="16"' : 'x1="0" x2="16" y1="8" y2="8"' } stroke="${c}" stroke-width="${w}"/>`,
|
||||
v = `<circle cx="8" cy="8" r="${w/2}" fill="${c}"/>`,
|
||||
s = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">${ o === 'circle' ? v : l }</svg>`;
|
||||
c2 = p.get('color2'),
|
||||
w = 1 * p.get('width'),
|
||||
l = `<line ${ o.slice(0, -1) === 'vertical' ? 'x1="8" x2="8" y1="0" y2="16"' : 'x1="0" x2="16" y1="8" y2="8"' } stroke="${c}" stroke-width="${w}"/>`,
|
||||
l2 = `<line ${ o.slice(0, -1) === 'vertical' ? `x1="${ w+9 }" x2="${w+9}" y1="0" y2="16"` : `x1="0" x2="16" y1="${ w+9 }" y2="${w+9}"` } stroke="${c2}" stroke-width="${w}"/>`
|
||||
console.log(`${l2}`)
|
||||
circle = `<circle cx="8" cy="8" r="${w/2}" fill="${c}"/>`,
|
||||
circle2 = `<circle cx="8" cy="8" r="${w/2}" fill="${c2}"/>`,
|
||||
s = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">${ o === 'circle' ? circle : l + (o.slice(-1) === '2' ? l2 : '') }</svg>`;
|
||||
a.innerHTML = s;
|
||||
f.href = `data:image/svg+xml,${encodeURIComponent(s)}`;
|
||||
r.style.value = o || 'vertical';
|
||||
r.width.value = w;
|
||||
r.color.value = c;
|
||||
r.color2.value = c2;
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
|
|
Loading…
Reference in New Issue