diff --git a/invokeai/frontend/web/src/common/components/IAIForms/IAIFormItemWrapper.tsx b/invokeai/frontend/web/src/common/components/IAIForms/IAIFormItemWrapper.tsx index 1b1ca29d76..83e91366c2 100644 --- a/invokeai/frontend/web/src/common/components/IAIForms/IAIFormItemWrapper.tsx +++ b/invokeai/frontend/web/src/common/components/IAIForms/IAIFormItemWrapper.tsx @@ -1,11 +1,13 @@ -import { Flex } from '@chakra-ui/react'; +import { Flex, useColorMode } from '@chakra-ui/react'; import { ReactElement } from 'react'; +import { mode } from 'theme/util/mode'; export function IAIFormItemWrapper({ children, }: { children: ReactElement | ReactElement[]; }) { + const { colorMode } = useColorMode(); return ( {children} diff --git a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/ModelManagerTab.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/ModelManagerTab.tsx index 8d675b17c8..7a56a3f651 100644 --- a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/ModelManagerTab.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/ModelManagerTab.tsx @@ -1,6 +1,14 @@ -import { Tab, TabList, TabPanel, TabPanels, Tabs } from '@chakra-ui/react'; +import { + Tab, + TabList, + TabPanel, + TabPanels, + Tabs, + useColorMode, +} from '@chakra-ui/react'; import i18n from 'i18n'; import { ReactNode, memo } from 'react'; +import { mode } from 'theme/util/mode'; import AddModelsPanel from './subpanels/AddModelsPanel'; import MergeModelsPanel from './subpanels/MergeModelsPanel'; import ModelManagerPanel from './subpanels/ModelManagerPanel'; @@ -31,41 +39,43 @@ const modelManagerTabs: ModelManagerTabInfo[] = [ }, ]; -const renderTabsList = () => { - const modelManagerTabListsToRender: ReactNode[] = []; - modelManagerTabs.forEach((modelManagerTab) => { - modelManagerTabListsToRender.push( - {modelManagerTab.label} - ); - }); - - return ( - - {modelManagerTabListsToRender} - - ); -}; - -const renderTabPanels = () => { - const modelManagerTabPanelsToRender: ReactNode[] = []; - modelManagerTabs.forEach((modelManagerTab) => { - modelManagerTabPanelsToRender.push( - {modelManagerTab.content} - ); - }); - - return {modelManagerTabPanelsToRender}; -}; - const ModelManagerTab = () => { + const { colorMode } = useColorMode(); + + const renderTabsList = () => { + const modelManagerTabListsToRender: ReactNode[] = []; + + modelManagerTabs.forEach((modelManagerTab) => { + modelManagerTabListsToRender.push( + {modelManagerTab.label} + ); + }); + + return ( + + {modelManagerTabListsToRender} + + ); + }; + + const renderTabPanels = () => { + const modelManagerTabPanelsToRender: ReactNode[] = []; + modelManagerTabs.forEach((modelManagerTab) => { + modelManagerTabPanelsToRender.push( + {modelManagerTab.content} + ); + }); + + return {modelManagerTabPanelsToRender}; + }; return ( state.ui.addNewModelUIOption ); + const { colorMode } = useColorMode(); + const dispatch = useAppDispatch(); const { t } = useTranslation(); @@ -20,27 +22,13 @@ export default function AddModelsPanel() { dispatch(setAddNewModelUIOption('ckpt'))} - sx={{ - backgroundColor: - addNewModelUIOption == 'ckpt' ? 'accent.700' : 'base.700', - '&:hover': { - backgroundColor: - addNewModelUIOption == 'ckpt' ? 'accent.700' : 'base.600', - }, - }} + isChecked={addNewModelUIOption == 'ckpt'} > {t('modelManager.addCheckpointModel')} dispatch(setAddNewModelUIOption('diffusers'))} - sx={{ - backgroundColor: - addNewModelUIOption == 'diffusers' ? 'accent.700' : 'base.700', - '&:hover': { - backgroundColor: - addNewModelUIOption == 'diffusers' ? 'accent.700' : 'base.600', - }, - }} + isChecked={addNewModelUIOption == 'diffusers'} > {t('modelManager.addDiffuserModel')} diff --git a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/ModelList.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/ModelList.tsx index 3eee71e576..803821f0e9 100644 --- a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/ModelList.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/ModelList.tsx @@ -1,4 +1,4 @@ -import { Box, Flex, Spinner, Text } from '@chakra-ui/react'; +import { Box, Flex, Spinner, Text, useColorMode } from '@chakra-ui/react'; import IAIButton from 'common/components/IAIButton'; import IAIInput from 'common/components/IAIInput'; @@ -9,6 +9,7 @@ import { useTranslation } from 'react-i18next'; import type { ChangeEvent, ReactNode } from 'react'; import React, { useMemo, useState, useTransition } from 'react'; import { useGetMainModelsQuery } from 'services/api/endpoints/models'; +import { mode } from 'theme/util/mode'; function ModelFilterButton({ label, @@ -20,16 +21,7 @@ function ModelFilterButton({ onClick: () => void; }) { return ( - + {label} ); @@ -37,6 +29,7 @@ function ModelFilterButton({ const ModelList = () => { const { data: mainModels } = useGetMainModelsQuery(); + const { colorMode } = useColorMode(); const [renderModelList, setRenderModelList] = React.useState(false); @@ -130,41 +123,46 @@ const ModelList = () => { {isSelectedFilter === 'all' && ( <> - - - {t('modelManager.diffusersModels')} - - {diffusersModelListItemsToRender} - - - - {t('modelManager.checkpointModels')} - - {ckptModelListItemsToRender} - + {diffusersModelListItemsToRender.length > 0 && ( + + + {t('modelManager.diffusersModels')} + + {diffusersModelListItemsToRender} + + )} + + {ckptModelListItemsToRender.length > 0 && ( + + + {t('modelManager.checkpointModels')} + + {ckptModelListItemsToRender} + + )} )} @@ -181,7 +179,7 @@ const ModelList = () => { )} ); - }, [mainModels, searchText, t, isSelectedFilter]); + }, [mainModels, searchText, t, isSelectedFilter, colorMode]); return ( diff --git a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/ModelListItem.tsx b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/ModelListItem.tsx index 61c2c8b5e2..993602da4c 100644 --- a/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/ModelListItem.tsx +++ b/invokeai/frontend/web/src/features/ui/components/tabs/ModelManager/subpanels/ModelManagerPanel/ModelListItem.tsx @@ -1,5 +1,12 @@ import { DeleteIcon, EditIcon } from '@chakra-ui/icons'; -import { Box, Flex, Spacer, Text, Tooltip } from '@chakra-ui/react'; +import { + Box, + Flex, + Spacer, + Text, + Tooltip, + useColorMode, +} from '@chakra-ui/react'; // import { deleteModel, requestModelChange } from 'app/socketio/actions'; import { RootState } from 'app/store/store'; @@ -9,6 +16,8 @@ import IAIIconButton from 'common/components/IAIIconButton'; import { setOpenModel } from 'features/system/store/systemSlice'; import { useTranslation } from 'react-i18next'; import { useDeleteMainModelsMutation } from 'services/api/endpoints/models'; +import { BaseModelType } from 'services/api/types'; +import { mode } from 'theme/util/mode'; type ModelListItemProps = { modelKey: string; @@ -21,6 +30,8 @@ export default function ModelListItem(props: ModelListItemProps) { (state: RootState) => state.system ); + const { colorMode } = useColorMode(); + const openModel = useAppSelector( (state: RootState) => state.system.openModel ); @@ -40,7 +51,7 @@ export default function ModelListItem(props: ModelListItemProps) { const handleModelDelete = () => { const [base_model, _, model_name] = modelKey.split('/'); deleteMainModel({ - base_model: base_model, + base_model: base_model as BaseModelType, model_name: model_name, }); dispatch(setOpenModel(null)); @@ -54,14 +65,14 @@ export default function ModelListItem(props: ModelListItemProps) { sx={ modelKey === openModel ? { - bg: 'accent.750', + bg: mode('accent.200', 'accent.600')(colorMode), _hover: { - bg: 'accent.750', + bg: mode('accent.200', 'accent.600')(colorMode), }, } : { _hover: { - bg: 'base.750', + bg: mode('base.100', 'base.800')(colorMode), }, } } diff --git a/invokeai/frontend/web/src/theme/components/button.ts b/invokeai/frontend/web/src/theme/components/button.ts index 7bb8a39a71..a59b9df826 100644 --- a/invokeai/frontend/web/src/theme/components/button.ts +++ b/invokeai/frontend/web/src/theme/components/button.ts @@ -19,16 +19,8 @@ const invokeAI = defineStyle((props) => { bg: mode('base.200', 'base.600')(props), color: mode('base.850', 'base.100')(props), borderRadius: 'base', - textShadow: mode( - '0 0 0.3rem var(--invokeai-colors-base-50)', - '0 0 0.3rem var(--invokeai-colors-base-900)' - )(props), svg: { fill: mode('base.850', 'base.100')(props), - filter: mode( - 'drop-shadow(0px 0px 0.3rem var(--invokeai-colors-base-100))', - 'drop-shadow(0px 0px 0.3rem var(--invokeai-colors-base-800))' - )(props), }, _hover: { bg: mode('base.300', 'base.500')(props), @@ -57,16 +49,8 @@ const invokeAI = defineStyle((props) => { bg: mode(`${c}.400`, `${c}.600`)(props), color: mode(`base.50`, `base.100`)(props), borderRadius: 'base', - textShadow: mode( - `0 0 0.3rem var(--invokeai-colors-${c}-600)`, - `0 0 0.3rem var(--invokeai-colors-${c}-800)` - )(props), svg: { fill: mode(`base.50`, `base.100`)(props), - filter: mode( - `drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${c}-600))`, - `drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${c}-800))` - )(props), }, _disabled, _hover: {