mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
feat(ui): remove themes, add hand-crafted dark and light modes
Themes are very fun but due to the differences in perceived saturation and lightness across the the color spectrum, it's impossible to have have multiple themes that look great without hand- crafting *every* shade for *every* theme. We've ended up with 4 OK themes (well, 3, because the light theme was pretty bad). I've removed the themes and added color mode support. There is now a single dark and light mode, each with their own color palette and the classic grey / purple / yellow invoke colors that @blessedcoolant first designed. I've re-styled almost everything except the model manager and lightbox, which I keep forgetting to work on. One new concept is the Chakra `layerStyle`. This lets us define "layers" - think body, first layer, second layer, etc - that can be applied on various components. By defining layers, we can be more consistent about the z-axis and its relationship to color and lightness.
This commit is contained in:
@@ -3,17 +3,10 @@ import {
|
||||
createLocalStorageManager,
|
||||
extendTheme,
|
||||
} from '@chakra-ui/react';
|
||||
import { RootState } from 'app/store/store';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import { ReactNode, useEffect } from 'react';
|
||||
import { ReactNode, useEffect, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { theme as invokeAITheme } from 'theme/theme';
|
||||
|
||||
import { greenTeaThemeColors } from 'theme/colors/greenTea';
|
||||
import { invokeAIThemeColors } from 'theme/colors/invokeAI';
|
||||
import { lightThemeColors } from 'theme/colors/lightTheme';
|
||||
import { oceanBlueColors } from 'theme/colors/oceanBlue';
|
||||
|
||||
import '@fontsource-variable/inter';
|
||||
import { MantineProvider } from '@mantine/core';
|
||||
import { mantineTheme } from 'mantine-theme/theme';
|
||||
@@ -24,29 +17,19 @@ type ThemeLocaleProviderProps = {
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
const THEMES = {
|
||||
dark: invokeAIThemeColors,
|
||||
light: lightThemeColors,
|
||||
green: greenTeaThemeColors,
|
||||
ocean: oceanBlueColors,
|
||||
};
|
||||
|
||||
const manager = createLocalStorageManager('@@invokeai-color-mode');
|
||||
|
||||
function ThemeLocaleProvider({ children }: ThemeLocaleProviderProps) {
|
||||
const { i18n } = useTranslation();
|
||||
|
||||
const currentTheme = useAppSelector(
|
||||
(state: RootState) => state.ui.currentTheme
|
||||
);
|
||||
|
||||
const direction = i18n.dir();
|
||||
|
||||
const theme = extendTheme({
|
||||
...invokeAITheme,
|
||||
colors: THEMES[currentTheme as keyof typeof THEMES],
|
||||
direction,
|
||||
});
|
||||
const theme = useMemo(() => {
|
||||
return extendTheme({
|
||||
...invokeAITheme,
|
||||
direction,
|
||||
});
|
||||
}, [direction]);
|
||||
|
||||
useEffect(() => {
|
||||
document.body.dir = direction;
|
||||
|
||||
Reference in New Issue
Block a user