@nomideusz/svelte-calendar 0.6.0 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,6 +63,13 @@ export interface RecurringEvent {
63
63
  export interface RecurringAdapterOptions {
64
64
  /** Start weeks on Monday (default: true) */
65
65
  mondayStart?: boolean;
66
+ /**
67
+ * Custom color palette for auto-coloring events.
68
+ * Pass `generatePalette('#yourAccent')` to get theme-harmonious colors,
69
+ * or provide your own array of hex strings.
70
+ * Defaults to the built-in vivid palette.
71
+ */
72
+ palette?: string[];
66
73
  }
67
74
  /**
68
75
  * Create a CalendarAdapter that projects recurring events onto concrete
@@ -230,8 +230,9 @@ const PALETTE = VIVID_PALETTE;
230
230
  * Read-only by default — create/update/delete throw.
231
231
  */
232
232
  export function createRecurringAdapter(schedule, options = {}) {
233
- const { mondayStart = true } = options;
234
- // Auto-color: assign from vivid palette by category/title
233
+ const { mondayStart = true, palette } = options;
234
+ const colors = palette?.length ? palette : PALETTE;
235
+ // Auto-color: assign from palette by category/title
235
236
  const colorAssignments = new Map();
236
237
  let colorIndex = 0;
237
238
  for (const rec of schedule) {
@@ -239,7 +240,7 @@ export function createRecurringAdapter(schedule, options = {}) {
239
240
  continue;
240
241
  const key = rec.category ?? rec.title;
241
242
  if (!colorAssignments.has(key)) {
242
- colorAssignments.set(key, PALETTE[colorIndex % PALETTE.length]);
243
+ colorAssignments.set(key, colors[colorIndex % colors.length]);
243
244
  colorIndex++;
244
245
  }
245
246
  }