mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-07 06:34:55 -05:00
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.
103 lines
3.0 KiB
TypeScript
103 lines
3.0 KiB
TypeScript
import { ChakraProps, Flex } from '@chakra-ui/react';
|
|
import { createSelector } from '@reduxjs/toolkit';
|
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
|
import IAIIconButton from 'common/components/IAIIconButton';
|
|
import { requestCanvasRescale } from 'features/canvas/store/thunks/requestCanvasScale';
|
|
import CancelButton from 'features/parameters/components/ProcessButtons/CancelButton';
|
|
import InvokeButton from 'features/parameters/components/ProcessButtons/InvokeButton';
|
|
import {
|
|
activeTabNameSelector,
|
|
uiSelector,
|
|
} from 'features/ui/store/uiSelectors';
|
|
import { setShouldShowParametersPanel } from 'features/ui/store/uiSlice';
|
|
import { isEqual } from 'lodash-es';
|
|
import { memo } from 'react';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { FaSlidersH } from 'react-icons/fa';
|
|
|
|
const floatingButtonStyles: ChakraProps['sx'] = {
|
|
borderStartStartRadius: 0,
|
|
borderEndStartRadius: 0,
|
|
shadow: '2xl',
|
|
};
|
|
|
|
export const floatingParametersPanelButtonSelector = createSelector(
|
|
[uiSelector, activeTabNameSelector],
|
|
(ui, activeTabName) => {
|
|
const {
|
|
shouldPinParametersPanel,
|
|
shouldUseCanvasBetaLayout,
|
|
shouldShowParametersPanel,
|
|
} = ui;
|
|
|
|
const canvasBetaLayoutCheck =
|
|
shouldUseCanvasBetaLayout && activeTabName === 'unifiedCanvas';
|
|
|
|
const shouldShowProcessButtons =
|
|
!canvasBetaLayoutCheck &&
|
|
(!shouldPinParametersPanel || !shouldShowParametersPanel);
|
|
|
|
const shouldShowParametersPanelButton =
|
|
!canvasBetaLayoutCheck &&
|
|
!shouldShowParametersPanel &&
|
|
['txt2img', 'img2img', 'unifiedCanvas'].includes(activeTabName);
|
|
|
|
return {
|
|
shouldPinParametersPanel,
|
|
shouldShowParametersPanelButton,
|
|
shouldShowProcessButtons,
|
|
};
|
|
},
|
|
{ memoizeOptions: { resultEqualityCheck: isEqual } }
|
|
);
|
|
|
|
const FloatingParametersPanelButtons = () => {
|
|
const dispatch = useAppDispatch();
|
|
const { t } = useTranslation();
|
|
const {
|
|
shouldShowProcessButtons,
|
|
shouldShowParametersPanelButton,
|
|
shouldPinParametersPanel,
|
|
} = useAppSelector(floatingParametersPanelButtonSelector);
|
|
|
|
const handleShowOptionsPanel = () => {
|
|
dispatch(setShouldShowParametersPanel(true));
|
|
shouldPinParametersPanel && dispatch(requestCanvasRescale());
|
|
};
|
|
|
|
if (!shouldShowParametersPanelButton) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Flex
|
|
pos="absolute"
|
|
transform="translate(0, -50%)"
|
|
minW={8}
|
|
top="50%"
|
|
insetInlineStart="4.5rem"
|
|
direction="column"
|
|
gap={2}
|
|
>
|
|
<IAIIconButton
|
|
tooltip="Show Options Panel (O)"
|
|
tooltipProps={{ placement: 'top' }}
|
|
aria-label={t('accessibility.showOptionsPanel')}
|
|
onClick={handleShowOptionsPanel}
|
|
sx={floatingButtonStyles}
|
|
>
|
|
<FaSlidersH />
|
|
</IAIIconButton>
|
|
{shouldShowProcessButtons && (
|
|
<>
|
|
<InvokeButton iconButton sx={floatingButtonStyles} />
|
|
<CancelButton sx={floatingButtonStyles} />
|
|
</>
|
|
)}
|
|
</Flex>
|
|
);
|
|
};
|
|
|
|
export default memo(FloatingParametersPanelButtons);
|