File "theme.js"
Full path: /home/orbitecv/orbite-school.orbit.et/resources/js/theme.js
File size: 833 B
MIME-type: text/x-java
Charset: utf-8
Download Open Edit Advanced Edit Back
import axios from "axios";
export const theme = {
primaryColor: "#b54dff",
subColor: "#f2e5ff",
textColor: "#131313",
applyTheme() {
document.documentElement.style.setProperty("--theme-primary", this.primaryColor);
document.documentElement.style.setProperty("--theme-sub", this.subColor);
document.documentElement.style.setProperty("--theme-text", this.textColor);
},
fetchThemeFromAPI() {
return axios.get("/theme/colors")
.then((res) => {
const data = res.data.theme_color;
this.primaryColor = data.primary_color;
this.subColor = data.sub_primary_color;
this.textColor = data.text_color;
this.applyTheme();
})
.catch((err) => console.error("Theme API Error:", err));
}
};