mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): regional prompting layout, styling
This commit is contained in:
committed by
Kent Keirsey
parent
e7523bd1d9
commit
c1aae0815d
@ -1,19 +0,0 @@
|
||||
import type { FlexProps } from '@invoke-ai/ui-library';
|
||||
import { Flex, forwardRef } from '@invoke-ai/ui-library';
|
||||
import { useMemo } from 'react';
|
||||
import type { RgbaColor, RgbColor } from 'react-colorful';
|
||||
|
||||
type Props = FlexProps & {
|
||||
previewColor: RgbColor | RgbaColor;
|
||||
};
|
||||
|
||||
export const ColorPreview = forwardRef((props: Props, ref) => {
|
||||
const { previewColor, ...rest } = props;
|
||||
const colorString = useMemo(() => {
|
||||
if ('a' in previewColor) {
|
||||
return `rgba(${previewColor.r}, ${previewColor.g}, ${previewColor.b}, ${previewColor.a ?? 1})`;
|
||||
}
|
||||
return `rgba(${previewColor.r}, ${previewColor.g}, ${previewColor.b}, 1)`;
|
||||
}, [previewColor]);
|
||||
return <Flex ref={ref} w="full" h="full" borderRadius="base" backgroundColor={colorString} {...rest} />;
|
||||
});
|
Reference in New Issue
Block a user