interstellar_ai/app/components/theme.ts
2024-10-01 08:13:52 +02:00

172 lines
13 KiB
TypeScript

export const applyIOMarketTheme = () => {
document.documentElement.style.setProperty('--header-background-color', '#7e7e7e');
document.documentElement.style.setProperty('--header-text-color', '#ffffff');
document.documentElement.style.setProperty('--background-color', '#8B9635');
document.documentElement.style.setProperty('--text-color', '#474D22');
document.documentElement.style.setProperty('--input-background-color', '#ffffff');
document.documentElement.style.setProperty('--input-button-color', '#8B9635');
document.documentElement.style.setProperty('--input-button-hover-color', '#6b7c2b');
document.documentElement.style.setProperty('--user-message-background-color', '#8B9635');
document.documentElement.style.setProperty('--user-message-text-color', '#000');
document.documentElement.style.setProperty('--ai-message-background-color', '#FCFCEB');
document.documentElement.style.setProperty('--ai-message-text-color', '#000');
document.documentElement.style.setProperty('--button-background-color', '#8B9635');
document.documentElement.style.setProperty('--button-hover-background-color', '#6b7c2b');
document.documentElement.style.setProperty('--models-background-color', '#ffffff');
document.documentElement.style.setProperty('--history-background-color', '#f9f9f9');
document.documentElement.style.setProperty('--left-panel-background-color', '#79832e');
document.documentElement.style.setProperty('--conversation-background-color', '#79832e');
document.documentElement.style.setProperty('--doc-background-color', '#ffffff');
document.documentElement.style.setProperty('--faq-background-color', '#474D22');
document.documentElement.style.setProperty('--faq-heading-color', '#8B9635');
document.documentElement.style.setProperty('--faq-item-background-color', '#fefefe');
document.documentElement.style.setProperty('--faq-item-heading-color', '#474D22');
document.documentElement.style.setProperty('--faq-item-text-color', '#333');
document.documentElement.style.setProperty('--faq-item-hover-background-color', '#e0e0e0');
document.documentElement.style.setProperty('--pop-up-text', '#000');
document.documentElement.style.setProperty('--input-border-color', '#8B9635');
document.documentElement.style.setProperty('--font-family', "'Poppins', 'sans-serif'");
document.documentElement.style.setProperty('--font-size', '16px');
document.documentElement.style.setProperty('--burger-menu-background-color', '#79832e');
};
export const applyWhiteTheme = () => {
document.documentElement.style.setProperty('--header-background-color', '#ffffff');
document.documentElement.style.setProperty('--header-text-color', '#000000');
document.documentElement.style.setProperty('--background-color', '#f0f0f0');
document.documentElement.style.setProperty('--text-color', '#000000');
document.documentElement.style.setProperty('--input-background-color', '#ffffff');
document.documentElement.style.setProperty('--input-button-color', '#007bff');
document.documentElement.style.setProperty('--input-button-hover-color', '#0056b3');
document.documentElement.style.setProperty('--user-message-background-color', '#ffffff');
document.documentElement.style.setProperty('--user-message-text-color', '#000000');
document.documentElement.style.setProperty('--ai-message-background-color', '#f9f9f9');
document.documentElement.style.setProperty('--ai-message-text-color', '#000000');
document.documentElement.style.setProperty('--button-background-color', '#007bff');
document.documentElement.style.setProperty('--button-hover-background-color', '#0056b3');
document.documentElement.style.setProperty('--models-background-color', '#ffffff');
document.documentElement.style.setProperty('--history-background-color', '#f9f9f9');
document.documentElement.style.setProperty('--left-panel-background-color', '#ffffff');
document.documentElement.style.setProperty('--conversation-background-color', '#ffffff');
document.documentElement.style.setProperty('--doc-background-color', '#ffffff');
document.documentElement.style.setProperty('--faq-background-color', '#ffffff');
document.documentElement.style.setProperty('--faq-heading-color', '#007bff');
document.documentElement.style.setProperty('--faq-item-background-color', '#f9f9f9');
document.documentElement.style.setProperty('--faq-item-heading-color', '#000000');
document.documentElement.style.setProperty('--faq-item-text-color', '#333333');
document.documentElement.style.setProperty('--faq-item-hover-background-color', '#e0e0e0');
document.documentElement.style.setProperty('--pop-up-text', '#000000');
document.documentElement.style.setProperty('--input-border-color', '#ced4da');
document.documentElement.style.setProperty('--font-family', "'Poppins', 'sans-serif'");
document.documentElement.style.setProperty('--font-size', '16px');
document.documentElement.style.setProperty('--burger-menu-background-color', '#79832e');
};
export const applyBlackTheme = () => {
document.documentElement.style.setProperty('--header-background-color', '#1a1a1a');
document.documentElement.style.setProperty('--header-text-color', '#ffffff');
document.documentElement.style.setProperty('--background-color', '#121212');
document.documentElement.style.setProperty('--text-color', '#e0e0e0');
document.documentElement.style.setProperty('--input-background-color', '#1e1e1e');
document.documentElement.style.setProperty('--input-button-color', '#3c3c3c');
document.documentElement.style.setProperty('--input-button-hover-color', '#5a5a5a');
document.documentElement.style.setProperty('--user-message-background-color', '#000000');
document.documentElement.style.setProperty('--user-message-text-color', '#ffffff');
document.documentElement.style.setProperty('--ai-message-background-color', '#202020');
document.documentElement.style.setProperty('--ai-message-text-color', '#ffffff');
document.documentElement.style.setProperty('--button-background-color', '#3c3c3c');
document.documentElement.style.setProperty('--button-hover-background-color', '#5a5a5a');
document.documentElement.style.setProperty('--models-background-color', '#1e1e1e');
document.documentElement.style.setProperty('--history-background-color', '#1a1a1a');
document.documentElement.style.setProperty('--left-panel-background-color', '#1e1e1e');
document.documentElement.style.setProperty('--conversation-background-color', '#2c2c2c');
document.documentElement.style.setProperty('--doc-background-color', '#1e1e1e');
document.documentElement.style.setProperty('--faq-background-color', '#2c2c2c');
document.documentElement.style.setProperty('--faq-heading-color', '#ffffff');
document.documentElement.style.setProperty('--faq-item-background-color', '#3c3c3c');
document.documentElement.style.setProperty('--faq-item-heading-color', '#ffffff');
document.documentElement.style.setProperty('--faq-item-text-color', '#e0e0e0');
document.documentElement.style.setProperty('--faq-item-hover-background-color', '#5a5a5a');
document.documentElement.style.setProperty('--pop-up-text', '#ffffff');
document.documentElement.style.setProperty('--input-border-color', '#3c3c3c');
document.documentElement.style.setProperty('--font-family', "'Poppins', 'sans-serif'");
document.documentElement.style.setProperty('--font-size', '16px');
document.documentElement.style.setProperty('--burger-menu-background-color', '#79832e');
};
export const applyCustomTheme = () => {
const themeVariables = {
backgroundColor: localStorage.getItem('backgroundColor'),
textColor: localStorage.getItem('textColor'),
inputBackgroundColor: localStorage.getItem('inputBackgroundColor'),
inputButtonColor: localStorage.getItem('inputButtonColor'),
inputButtonHoverColor: localStorage.getItem('inputButtonHoverColor'),
userMessageBackgroundColor: localStorage.getItem('userMessageBackgroundColor'),
userMessageTextColor: localStorage.getItem('userMessageTextColor'),
aiMessageBackgroundColor: localStorage.getItem('aiMessageBackgroundColor'),
aiMessageTextColor: localStorage.getItem('aiMessageTextColor'),
buttonBackgroundColor: localStorage.getItem('buttonBackgroundColor'),
buttonHoverBackgroundColor: localStorage.getItem('buttonHoverBackgroundColor'),
modelsBackgroundColor: localStorage.getItem('modelsBackgroundColor'),
historyBackgroundColor: localStorage.getItem('historyBackgroundColor'),
leftPanelBackgroundColor: localStorage.getItem('leftPanelBackgroundColor'),
conversationBackgroundColor: localStorage.getItem('conversationBackgroundColor'),
faqBackgroundColor: localStorage.getItem('faqBackgroundColor'),
faqHeadingColor: localStorage.getItem('faqHeadingColor'),
faqItemBackgroundColor: localStorage.getItem('faqItemBackgroundColor'),
faqItemHeadingColor: localStorage.getItem('faqItemHeadingColor'),
faqItemTextColor: localStorage.getItem('faqItemTextColor'),
faqItemHoverBackgroundColor: localStorage.getItem('faqItemHoverBackgroundColor'),
inputBorderColor: localStorage.getItem('inputBorderColor'),
fontFamily: localStorage.getItem('fontFamily'),
fontSize: localStorage.getItem('fontSize'),
burgerMenu: localStorage.getItem('burgerMenu'),
};
document.documentElement.style.setProperty('--background-color', themeVariables.backgroundColor || '#121212');
document.documentElement.style.setProperty('--text-color', themeVariables.textColor || '#e0e0e0');
document.documentElement.style.setProperty('--input-background-color', themeVariables.inputBackgroundColor || '#1e1e1e');
document.documentElement.style.setProperty('--input-button-color', themeVariables.inputButtonColor || '#3c3c3c');
document.documentElement.style.setProperty('--input-button-hover-color', themeVariables.inputButtonHoverColor || '#5a5a5a');
document.documentElement.style.setProperty('--user-message-background-color', themeVariables.userMessageBackgroundColor || '#000000');
document.documentElement.style.setProperty('--user-message-text-color', themeVariables.userMessageTextColor || '#ffffff');
document.documentElement.style.setProperty('--ai-message-background-color', themeVariables.aiMessageBackgroundColor || '#202020');
document.documentElement.style.setProperty('--ai-message-text-color', themeVariables.aiMessageTextColor || '#ffffff');
document.documentElement.style.setProperty('--button-background-color', themeVariables.buttonBackgroundColor || '#3c3c3c');
document.documentElement.style.setProperty('--button-hover-background-color', themeVariables.buttonHoverBackgroundColor || '#5a5a5a');
document.documentElement.style.setProperty('--models-background-color', themeVariables.modelsBackgroundColor || '#1e1e1e');
document.documentElement.style.setProperty('--history-background-color', themeVariables.historyBackgroundColor || '#1a1a1a');
document.documentElement.style.setProperty('--left-panel-background-color', themeVariables.leftPanelBackgroundColor || '#1e1e1e');
document.documentElement.style.setProperty('--conversation-background-color', themeVariables.conversationBackgroundColor || '#2c2c2c');
document.documentElement.style.setProperty('--faq-background-color', themeVariables.faqBackgroundColor || '#2c2c2c');
document.documentElement.style.setProperty('--faq-heading-color', themeVariables.faqHeadingColor || '#ffffff');
document.documentElement.style.setProperty('--faq-item-background-color', themeVariables.faqItemBackgroundColor || '#3c3c3c');
document.documentElement.style.setProperty('--faq-item-heading-color', themeVariables.faqItemHeadingColor || '#ffffff');
document.documentElement.style.setProperty('--faq-item-text-color', themeVariables.faqItemTextColor || '#e0e0e0');
document.documentElement.style.setProperty('--faq-item-hover-background-color', themeVariables.faqItemHoverBackgroundColor || '#5a5a5a');
document.documentElement.style.setProperty('--input-border-color', themeVariables.inputBorderColor || '#3c3c3c');
document.documentElement.style.setProperty('--font-family', themeVariables.fontFamily || "'Poppins', 'sans-serif'");
document.documentElement.style.setProperty('--font-size', themeVariables.fontSize || '16px');
document.documentElement.style.setProperty('--burger-menu-background-color', themeVariables.burgerMenu || '#79832e');
};
// This is the new function that calls the appropriate theme application
export const applyTheme = (theme: string) => {
switch (theme) {
case 'IOMARKET':
applyIOMarketTheme();
break;
case 'WHITE':
applyWhiteTheme();
break;
case 'BLACK':
applyBlackTheme();
break;
case 'CUSTOM':
// Handle custom theme application here if necessary
break;
default:
applyIOMarketTheme();
break;
}
};