แก้สีปฏิทิน
This commit is contained in:
parent
303fdf2487
commit
357fffff2c
1 changed files with 3 additions and 23 deletions
|
|
@ -77,23 +77,10 @@ const dateMonth = ref<DataDateMonthObject>({
|
||||||
year: new Date().getFullYear(),
|
year: new Date().getFullYear(),
|
||||||
});
|
});
|
||||||
|
|
||||||
/** function เรียกข่อมูล calendar*/
|
|
||||||
function getRandomColor() {
|
|
||||||
return (
|
|
||||||
"hsl(" +
|
|
||||||
360 * Math.random() +
|
|
||||||
"," +
|
|
||||||
(25 + 70 * Math.random()) +
|
|
||||||
"%," +
|
|
||||||
(85 + 10 * Math.random()) +
|
|
||||||
"%)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fetchCalendar() {
|
async function fetchCalendar() {
|
||||||
showLoader();
|
showLoader();
|
||||||
const defaultColor = "#E3FDDA";
|
const defaultColor = "#e3fdda";
|
||||||
const gradientColors = generateGradientColors(props.lists.length);
|
const gradientColors = '#f7d0dd'
|
||||||
|
|
||||||
const events = await props.lists.map(
|
const events = await props.lists.map(
|
||||||
(e: ExtendHistoryObject, index: number) => ({
|
(e: ExtendHistoryObject, index: number) => ({
|
||||||
|
|
@ -104,7 +91,7 @@ async function fetchCalendar() {
|
||||||
allDay: false,
|
allDay: false,
|
||||||
color:
|
color:
|
||||||
props.lists.length > 1 && index > 0
|
props.lists.length > 1 && index > 0
|
||||||
? gradientColors[index]
|
? gradientColors
|
||||||
: defaultColor,
|
: defaultColor,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -120,13 +107,6 @@ async function fetchCalendar() {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateGradientColors(length: number) {
|
|
||||||
const colors = [];
|
|
||||||
for (let i = 0; i < length; i++) {
|
|
||||||
colors.push(getRandomColor());
|
|
||||||
}
|
|
||||||
return colors;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function convert เดือนปี
|
* function convert เดือนปี
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue