Skip to content

Commit 0a86dad

Browse files
committed
feat(calendar): added weekendSat, weekendSun and differentMonth classes
closes #1362
1 parent a1bc377 commit 0a86dad

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

src/defaults.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ export default {
8484
calEventBackgroundColor: 'rgba(86, 100, 86, .35)',
8585

8686
calActiveEventBackgroundColor: 'rgba(86, 128, 86, .35)',
87-
calEventSatColor: 'rgba(255, 255, 255, .05)',
88-
calEventSunColor: 'rgba(255, 255, 255, .15)',
8987

9088
calEventTime: false, // show calendar event summary time
9189

src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -583,10 +583,10 @@ export class AtomicCalendarRevive extends LitElement {
583583

584584
return month.map((day: CalendarDay, i) => {
585585
const dayDate = dayjs(day.date);
586-
const dayStyleOtherMonth = dayDate.isSame(this.selectedMonth, 'month') ? '' : `opacity: .35;`;
586+
const dayStyleOtherMonth = dayDate.isSame(this.selectedMonth, 'month') ? '' : `differentMonth`;
587587
const dayClassToday = dayDate.isSame(dayjs(), 'day') ? `currentDay` : ``;
588-
const dayStyleSat = dayDate.isoWeekday() == 6 ? `background-color: ${this._config.calEventSatColor};` : ``;
589-
const dayStyleSun = dayDate.isoWeekday() == 7 ? `background-color: ${this._config.calEventSunColor};` : ``;
588+
const dayStyleSat = dayDate.isoWeekday() == 6 ? `weekendSat` : ``;
589+
const dayStyleSun = dayDate.isoWeekday() == 7 ? `weekendSun` : ``;
590590
const dayStyleClicked = dayDate.isSame(dayjs(this.clickedDate), 'day')
591591
? `background-color: ${this._config.calActiveEventBackgroundColor};`
592592
: ``;
@@ -599,8 +599,8 @@ export class AtomicCalendarRevive extends LitElement {
599599
${i % 7 === 0 ? html`<tr class="cal"></tr>` : ''}
600600
<td
601601
@click="${() => this.handleCalendarEventSummary(day, true)}"
602-
class="cal"
603-
style="${dayStyleOtherMonth}${dayStyleSat}${dayStyleSun}${dayStyleClicked} --cal-grid-color: ${this._config
602+
class="cal ${dayStyleSat} ${dayStyleSun} ${dayStyleOtherMonth}"
603+
style="${dayStyleClicked} --cal-grid-color: ${this._config
604604
.calGridColor}; --cal-day-color: ${this._config.calDayColor}"
605605
>
606606
<div class="calDay">

src/style.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,18 @@ export const styles: CSSResultGroup = css`
278278
display: inline-block;
279279
}
280280
281+
.weekendSat {
282+
background-color: rgba(255, 255, 255, .05);
283+
}
284+
285+
.weekendSun {
286+
background-color: rgba(255, 255, 255, .15);
287+
}
288+
289+
.differentMonth {
290+
opacity: .35;
291+
}
292+
281293
tr.cal {
282294
width: 100%;
283295
}

src/types/config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ export interface atomicCardConfig extends LovelaceCardConfig {
8282
calEventBackgroundFilter?: string;
8383
calActiveEventBackgroundColor?: string;
8484
calActiveEventBackgroundFilter?: string;
85-
calEventSatColor?: string;
86-
calEventSunColor?: string;
8785
calEventHolidayColor?: string;
8886
calEventHolidayFilter?: string;
8987
calEventIcon1?: string;

0 commit comments

Comments
 (0)