Skip to content
This repository was archived by the owner on Oct 29, 2025. It is now read-only.

Commit 086d32c

Browse files
committed
Moved the themes to the utils page because ill be using them in other places too.
1 parent 42d341d commit 086d32c

File tree

2 files changed

+45
-43
lines changed

2 files changed

+45
-43
lines changed

src/lib/Calendar.svelte

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import type { EventData } from "$lib";
44
import Day from "$lib/Day.svelte";
55
import { onMount } from "svelte";
6-
import type { CalendarThemes, CustomTheme } from "./utils";
6+
import { DARK_THEME, LIGHT_THEME, type CalendarThemes, type CustomTheme } from "./utils";
77
88
export let events: EventData[];
99
export let theme: CalendarThemes;
@@ -18,48 +18,6 @@
1818
1919
function chooseStyle() {
2020
let tempStyle = "";
21-
const LIGHT_THEME: CustomTheme = {
22-
"backgroundColor": "#ededed",
23-
"headerColor": "#b3b3b3",
24-
"dayTextColor": "#f5f5f5",
25-
"dayOfWeekSize": "2rem",
26-
"selectedDayTextColor": "#ffffff",
27-
"headerHeight": "80px",
28-
"headerBoxShadow": "0px 8px 18px -18px rgb(0, 0, 0)",
29-
"daySeparatorLineWidth": "1px",
30-
"daySeparatorLineStyle": "solid",
31-
"daySeparatorLineColor": "#9e9e9e",
32-
"eventBorderRadius": "3px",
33-
"eventTitleColor": "#6a81a4",
34-
"eventTitleFontSize": "clamp(0.9rem, 0.6951rem + 0.6829vw, 1.25rem)",
35-
"tagFontSize": "0.6rem",
36-
"timeTextColor": "#545454",
37-
"timeTextFontSize": "clamp(0.8rem, 0rem + 1.4vw, 1rem)",
38-
"eventBackgroundColor": "#adadad",
39-
"resourceFontSize": "1rem",
40-
"resourceTextColor": "#ffffff"
41-
}
42-
const DARK_THEME: CustomTheme = {
43-
backgroundColor: "#303030",
44-
headerColor: "#212121",
45-
dayTextColor: "#ffffff",
46-
dayOfWeekSize: "2rem",
47-
selectedDayTextColor: "#8AB4F4",
48-
headerHeight: "80px",
49-
headerBoxShadow: "0px 8px 18px -18px rgb(0, 0, 0)",
50-
daySeparatorLineWidth: "1px",
51-
daySeparatorLineStyle: "dashed",
52-
daySeparatorLineColor: "#202020",
53-
eventBackgroundColor: "#424242",
54-
eventBorderRadius: "3px",
55-
eventTitleColor: "#8AB4F4",
56-
eventTitleFontSize: "clamp(0.9rem, 0.6951rem + 0.6829vw, 1.25rem)",
57-
resourceTextColor: "#ffffff",
58-
resourceFontSize: "1rem",
59-
tagFontSize: "0.6rem",
60-
timeTextColor: "#fdfdfd",
61-
timeTextFontSize: "clamp(0.8rem, 0rem + 1.4vw, 1rem)"
62-
}
6321
if (theme === "CUSTOM") {
6422
for (let i=0;i<Object.keys(customTheme).length;i++) {
6523
tempStyle += `--${Object.keys(customTheme)[i]}:${customTheme[Object.keys(customTheme)[i]]};`;

src/lib/utils.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,48 @@ export type CustomTheme = {
128128
timeTextColor: string,
129129
timeTextFontSize: string,
130130
[key: string]: any
131+
}
132+
133+
export const LIGHT_THEME: CustomTheme = {
134+
"backgroundColor": "#ededed",
135+
"headerColor": "#b3b3b3",
136+
"dayTextColor": "#f5f5f5",
137+
"dayOfWeekSize": "2rem",
138+
"selectedDayTextColor": "#ffffff",
139+
"headerHeight": "80px",
140+
"headerBoxShadow": "0px 8px 18px -18px rgb(0, 0, 0)",
141+
"daySeparatorLineWidth": "1px",
142+
"daySeparatorLineStyle": "solid",
143+
"daySeparatorLineColor": "#9e9e9e",
144+
"eventBorderRadius": "3px",
145+
"eventTitleColor": "#6a81a4",
146+
"eventTitleFontSize": "clamp(0.9rem, 0.6951rem + 0.6829vw, 1.25rem)",
147+
"tagFontSize": "0.6rem",
148+
"timeTextColor": "#545454",
149+
"timeTextFontSize": "clamp(0.8rem, 0rem + 1.4vw, 1rem)",
150+
"eventBackgroundColor": "#adadad",
151+
"resourceFontSize": "1rem",
152+
"resourceTextColor": "#ffffff"
153+
}
154+
155+
export const DARK_THEME: CustomTheme = {
156+
backgroundColor: "#303030",
157+
headerColor: "#212121",
158+
dayTextColor: "#ffffff",
159+
dayOfWeekSize: "2rem",
160+
selectedDayTextColor: "#8AB4F4",
161+
headerHeight: "80px",
162+
headerBoxShadow: "0px 8px 18px -18px rgb(0, 0, 0)",
163+
daySeparatorLineWidth: "1px",
164+
daySeparatorLineStyle: "dashed",
165+
daySeparatorLineColor: "#202020",
166+
eventBackgroundColor: "#424242",
167+
eventBorderRadius: "3px",
168+
eventTitleColor: "#8AB4F4",
169+
eventTitleFontSize: "clamp(0.9rem, 0.6951rem + 0.6829vw, 1.25rem)",
170+
resourceTextColor: "#ffffff",
171+
resourceFontSize: "1rem",
172+
tagFontSize: "0.6rem",
173+
timeTextColor: "#fdfdfd",
174+
timeTextFontSize: "clamp(0.8rem, 0rem + 1.4vw, 1rem)"
131175
}

0 commit comments

Comments
 (0)