feat: Update clock to use color from CSS
This commit is contained in:
parent
86fce27554
commit
1a1badc786
2 changed files with 18 additions and 3 deletions
|
|
@ -23,6 +23,9 @@ tags:
|
|||
const canvas = document.getElementById('clock');
|
||||
const ctx = canvas.getContext('2d');
|
||||
let is24HourFormat = true;
|
||||
const colorDayOfWeek = getComputedStyle(document.documentElement).getPropertyValue('--clock-color-yellow').trim();
|
||||
const colorDayOfMonth = getComputedStyle(document.documentElement).getPropertyValue('--clock-color-orange').trim();
|
||||
const colorMonth = getComputedStyle(document.documentElement).getPropertyValue('--clock-color-pink').trim();
|
||||
|
||||
document.getElementById('toggleFormat').addEventListener('click', () => {
|
||||
is24HourFormat = !is24HourFormat;
|
||||
|
|
@ -57,9 +60,9 @@ tags:
|
|||
maxSize - (lineWidth + lineGap) * 2,
|
||||
'white'
|
||||
);
|
||||
drawArc(dayOfWeek, 7, maxSize - (lineWidth + lineGap) * 3, '#fad803');
|
||||
drawArc(dayOfMonth, daysInCurrentMonth, maxSize - (lineWidth + lineGap) * 4, '#d30a51');
|
||||
drawArc(month, 12, maxSize - (lineWidth + lineGap) * 5, '#273f8b');
|
||||
drawArc(dayOfWeek, 7, maxSize - (lineWidth + lineGap) * 3, colorDayOfWeek);
|
||||
drawArc(dayOfMonth, daysInCurrentMonth, maxSize - (lineWidth + lineGap) * 4, colorDayOfMonth);
|
||||
drawArc(month, 12, maxSize - (lineWidth + lineGap) * 5, colorMonth);
|
||||
}
|
||||
|
||||
function updateCircle() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,17 @@
|
|||
@use "../../hippie-style/hippie";
|
||||
|
||||
:root {
|
||||
--clock-color-yellow: rgb(250, 216, 3);
|
||||
--clock-color-orange: rgb(242, 175, 19);
|
||||
--clock-color-pink: rgb(211, 10, 81);
|
||||
--clock-color-purple: rgb(142, 31, 104);
|
||||
--clock-color-blue: rgb(39, 63, 139);
|
||||
--clock-color-pblue: rgb(60, 87, 154);
|
||||
--clock-color-lblue: rgb(183, 224, 240);
|
||||
--clock-color-lcyan: rgb(107, 199, 217);
|
||||
--clock-color-cyan: rgb(82, 190, 209);
|
||||
}
|
||||
|
||||
.body_clock {
|
||||
main {
|
||||
@extend .sec_main_center;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue