mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
Add theme color support
This commit is contained in:
parent
04fa9fec3e
commit
3aafb96af3
2 changed files with 6 additions and 0 deletions
|
|
@ -4,6 +4,7 @@
|
|||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, viewport-fit=cover">
|
||||
<meta name="description" content="itty bitty things can be conveyed in a link.">
|
||||
<meta id="themeColor" name="theme-color" content="#ebeff9">
|
||||
<link id="favicon" rel="icon" href='/favicon.svg'>
|
||||
<link rel="stylesheet" href="/index.css">
|
||||
<script src="/js/lzma/lzma-d-min.js"></script>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@
|
|||
// </div>`
|
||||
}
|
||||
|
||||
function setThemeColor(color) {
|
||||
document.getElementById("themeColor").content = color;
|
||||
}
|
||||
|
||||
function setFavicon(favicon) {
|
||||
document.getElementById("favicon").href = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em"><text y=".9em">'+ favicon + '</text></svg>'
|
||||
}
|
||||
|
|
@ -48,6 +52,7 @@
|
|||
console.debug("Message:", e.origin, e.data)
|
||||
if (e.data.title) document.title = e.data.title;
|
||||
if (e.data.favicon) setFavicon(e.data.favicon);
|
||||
if (e.data.themeColor) setThemeColor(e.data.themeColor);
|
||||
if (e.data.updateURL) {
|
||||
let path = ["/" + e.data.title.replace(/\s/g, "-")];
|
||||
if (e.data.description) path.push("d/" + encodeURIComponent(e.data.description));
|
||||
|
|
|
|||
Loading…
Reference in a new issue