Last active
September 27, 2022 18:42
-
-
Save unlimish/f3ddf755c299324c3a6b7650238a9d7c to your computer and use it in GitHub Desktop.
Clock widget for stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#time { | |
font-size: {{timeSize}}px; | |
font-family: 'Quicksand', sans-serif; | |
font-weight: {{fontWeightTime}}; | |
color:{{timeColor}}; | |
} | |
#date { | |
font-size: {{dateSize}}px; | |
font-family: 'Quicksand', sans-serif; | |
font-weight: {{fontWeightDate}}; | |
color:{{dateColor}}; | |
padding: 6px; | |
line-height: 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://fonts.googleapis.com/css?family=Quicksand:400,700" rel="stylesheet"> | |
<div id="date"></div> | |
<div id="time"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function startTime() { | |
const date = new Date(); | |
const formTime = date.toLocaleTimeString('en-GB'); | |
const formDate = new Intl.DateTimeFormat('en-US',{dateStyle: "{{dateFormat}}"}).format(date); | |
document.getElementById('date').innerHTML = formDate; | |
document.getElementById('time').innerHTML = formTime; | |
const t = setTimeout(startTime, 500); | |
} | |
startTime(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"fontFamily": { | |
"type": "googleFont", | |
"label": "Font family", | |
"value": "Noto Sans" | |
}, | |
"dateFormat": { | |
"type": "dropdown", | |
"label": "Date Format", | |
"value": "medium", | |
"options": { | |
"full": "Full", | |
"long": "Long", | |
"medium": "Medium", | |
"short": "Short" | |
} | |
}, | |
"dateColor": { | |
"type": "colorpicker", | |
"label": "Date color", | |
"value": "#FFFFFF" | |
}, | |
"fontWeightDate": { | |
"label": "Date Weight", | |
"type": "dropdown", | |
"value": "400", | |
"options": { | |
"100": "Thin (100)", | |
"300": "Light (300)", | |
"400": "Regular (400)", | |
"500": "Medium (500)", | |
"700": "Bold (700)" | |
} | |
}, | |
"dateSize": { | |
"type": "number", | |
"label": "Date Font Size", | |
"value": 20 | |
}, | |
"timeColor": { | |
"type": "colorpicker", | |
"label": "Time color", | |
"value": "#FFFFFF" | |
}, | |
"fontWeightTime": { | |
"label": "Time Weight", | |
"type": "dropdown", | |
"value": "600", | |
"options": { | |
"100": "Thin (100)", | |
"300": "Light (300)", | |
"400": "Regular (400)", | |
"500": "Medium (500)", | |
"600": "Medium (600)", | |
"700": "Bold (700)" | |
} | |
}, | |
"timeSize": { | |
"type": "number", | |
"label": "Time Font Size", | |
"value": 60 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment