tweak site bg color, to let card elements "pop"

This has been bothering me for a long time, but I couldn't really figure out what to do about it. But tweaking the site bg color a smidge has helped us really add texture to the cards I want to have pop out, like the outfit polaroids!

I kinda went all-in in a burst, but tbh I think it looks great :3

I haven't really touched the wardrobe page with it yet though, that'll probably need some tweaking... for now I'm overriding it to keep the old background!
This commit is contained in:
Emi Matchu 2021-01-04 09:17:30 +00:00
parent 98604b39da
commit c9603a40ea
7 changed files with 49 additions and 23 deletions

View file

@ -42,6 +42,7 @@ const theme = extendTheme({
height: "100%", height: "100%",
}, },
body: { body: {
background: mode("gray.50", "gray.800")(props),
color: mode("green.800", "green.50")(props), color: mode("green.800", "green.50")(props),
transition: "all 0.25s", transition: "all 0.25s",
}, },

View file

@ -15,7 +15,12 @@ import {
import { useHistory, useLocation } from "react-router-dom"; import { useHistory, useLocation } from "react-router-dom";
import { useLazyQuery } from "@apollo/client"; import { useLazyQuery } from "@apollo/client";
import { Heading1, useLocalStorage, usePageTitle } from "./util"; import {
Heading1,
useCommonStyles,
useLocalStorage,
usePageTitle,
} from "./util";
import OutfitPreview from "./components/OutfitPreview"; import OutfitPreview from "./components/OutfitPreview";
import SpeciesColorPicker from "./components/SpeciesColorPicker"; import SpeciesColorPicker from "./components/SpeciesColorPicker";
@ -207,6 +212,7 @@ function SubmitPetForm() {
import("./WardrobePage"); import("./WardrobePage");
}; };
const { brightBackground } = useCommonStyles();
const inputBorderColor = useColorModeValue("green.600", "green.500"); const inputBorderColor = useColorModeValue("green.600", "green.500");
const inputBorderColorHover = useColorModeValue("green.400", "green.300"); const inputBorderColorHover = useColorModeValue("green.400", "green.300");
const buttonBgColor = useColorModeValue("green.600", "green.300"); const buttonBgColor = useColorModeValue("green.600", "green.300");
@ -225,6 +231,7 @@ function SubmitPetForm() {
aria-label="Enter a pet's name" aria-label="Enter a pet's name"
borderColor={inputBorderColor} borderColor={inputBorderColor}
_hover={{ borderColor: inputBorderColorHover }} _hover={{ borderColor: inputBorderColorHover }}
background={brightBackground}
boxShadow="md" boxShadow="md"
width="14em" width="14em"
className={css` className={css`
@ -252,12 +259,16 @@ function SubmitPetForm() {
} }
function FeedbackFormSection() { function FeedbackFormSection() {
const { brightBackground } = useCommonStyles();
const pitchBorderColor = useColorModeValue("gray.300", "green.400"); const pitchBorderColor = useColorModeValue("gray.300", "green.400");
const formBorderColor = useColorModeValue("gray.300", "blue.400"); const formBorderColor = useColorModeValue("gray.300", "blue.400");
return ( return (
<VStack spacing="4" alignItems="stretch"> <VStack spacing="4" alignItems="stretch">
<FeedbackFormContainer borderColor={pitchBorderColor}> <FeedbackFormContainer
background={brightBackground}
borderColor={pitchBorderColor}
>
<Flex position="relative" alignItems="center"> <Flex position="relative" alignItems="center">
<Box padding="2" borderRadius="lg" overflow="hidden" flex="0 0 auto"> <Box padding="2" borderRadius="lg" overflow="hidden" flex="0 0 auto">
<Box <Box
@ -293,10 +304,11 @@ function FeedbackFormSection() {
); );
} }
function FeedbackFormContainer({ borderColor, children }) { function FeedbackFormContainer({ background, borderColor, children }) {
return ( return (
<Box <Box
as="section" as="section"
background={background}
border="1px solid" border="1px solid"
borderColor={borderColor} borderColor={borderColor}
borderRadius="lg" borderRadius="lg"
@ -305,6 +317,7 @@ function FeedbackFormContainer({ borderColor, children }) {
paddingLeft="2" paddingLeft="2"
paddingRight="4" paddingRight="4"
paddingY="2" paddingY="2"
transition="all 0.2s"
> >
{children} {children}
</Box> </Box>
@ -379,6 +392,8 @@ function FeedbackForm() {
[content, email, toast] [content, email, toast]
); );
const { brightBackground } = useCommonStyles();
return ( return (
<Box <Box
as="form" as="form"
@ -397,6 +412,7 @@ function FeedbackForm() {
gridArea="email" gridArea="email"
value={email} value={email}
onChange={(e) => setEmail(e.target.value)} onChange={(e) => setEmail(e.target.value)}
background={brightBackground}
/> />
<Textarea <Textarea
size="sm" size="sm"
@ -404,6 +420,7 @@ function FeedbackForm() {
gridArea="content" gridArea="content"
value={content} value={content}
onChange={(e) => setContent(e.target.value)} onChange={(e) => setContent(e.target.value)}
background={brightBackground}
/> />
<Button <Button
type="submit" type="submit"

View file

@ -1,16 +1,9 @@
import React from "react"; import React from "react";
import { import { Box, Center, Flex, Wrap, WrapItem } from "@chakra-ui/react";
Box,
Center,
Flex,
Wrap,
WrapItem,
useColorModeValue,
} from "@chakra-ui/react";
import gql from "graphql-tag"; import gql from "graphql-tag";
import { useQuery } from "@apollo/client"; import { useQuery } from "@apollo/client";
import { ErrorMessage, Heading1 } from "./util"; import { ErrorMessage, Heading1, useCommonStyles } from "./util";
import { import {
getVisibleLayers, getVisibleLayers,
petAppearanceFragmentForGetVisibleLayers, petAppearanceFragmentForGetVisibleLayers,
@ -106,8 +99,7 @@ function OutfitCard({ outfit }) {
outfit.itemAppearances outfit.itemAppearances
); );
const cardBackground = useColorModeValue("white", "gray.700"); const { brightBackground } = useCommonStyles();
const thumbnailBackground = useColorModeValue("gray.600", "gray.600");
return ( return (
<Flex <Flex
@ -118,7 +110,7 @@ function OutfitCard({ outfit }) {
borderRadius="md" borderRadius="md"
padding="3" padding="3"
width="calc(150px + 2em)" width="calc(150px + 2em)"
background={cardBackground} backgroundColor={brightBackground}
transition="all 0.2s" transition="all 0.2s"
> >
<Box <Box
@ -128,7 +120,7 @@ function OutfitCard({ outfit }) {
height={150} height={150}
marginBottom="2" marginBottom="2"
borderRadius="md" borderRadius="md"
background={thumbnailBackground} background="gray.600"
transition="all 0.2s" transition="all 0.2s"
/> />
<Box>{outfit.name}</Box> <Box>{outfit.name}</Box>

View file

@ -1,7 +1,9 @@
import React from "react"; import React from "react";
import { Box, Grid } from "@chakra-ui/react"; import { Box, Grid, useColorModeValue } from "@chakra-ui/react";
function WardrobePageLayout({ preview, controls, itemsAndSearch }) { function WardrobePageLayout({ preview, controls, itemsAndSearch }) {
const itemsAndSearchBackground = useColorModeValue("white", "gray.900");
return ( return (
<Box <Box
position="absolute" position="absolute"
@ -38,7 +40,9 @@ function WardrobePageLayout({ preview, controls, itemsAndSearch }) {
{controls} {controls}
</Box> </Box>
</Box> </Box>
<Box gridArea="itemsAndSearch">{itemsAndSearch}</Box> <Box gridArea="itemsAndSearch" bg={itemsAndSearchBackground}>
{itemsAndSearch}
</Box>
</Grid> </Grid>
</Box> </Box>
); );

View file

@ -14,10 +14,10 @@ import { CheckIcon, NotAllowedIcon, StarIcon } from "@chakra-ui/icons";
import { HiSparkles } from "react-icons/hi"; import { HiSparkles } from "react-icons/hi";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { safeImageUrl } from "../util"; import { safeImageUrl, useCommonStyles } from "../util";
function ItemCard({ item, badges, ...props }) { function ItemCard({ item, badges, ...props }) {
const borderColor = useColorModeValue("gray.100", "green.500"); const { brightBackground } = useCommonStyles();
return ( return (
<Box <Box
@ -27,8 +27,8 @@ function ItemCard({ item, badges, ...props }) {
p="2" p="2"
boxShadow="lg" boxShadow="lg"
borderRadius="lg" borderRadius="lg"
border="1px" background={brightBackground}
borderColor={borderColor} transition="all 0.2s"
className="item-card" className="item-card"
width="100%" width="100%"
minWidth="0" minWidth="0"

View file

@ -1,15 +1,21 @@
import React from "react"; import React from "react";
import { Box, Flex, Tooltip } from "@chakra-ui/react"; import { Box, Flex, Tooltip } from "@chakra-ui/react";
import { useCommonStyles } from "../util";
import WIPXweeImg from "../images/wip-xwee.png"; import WIPXweeImg from "../images/wip-xwee.png";
import WIPXweeImg2x from "../images/wip-xwee@2x.png"; import WIPXweeImg2x from "../images/wip-xwee@2x.png";
function WIPCallout({ children, details }) { function WIPCallout({ children, details }) {
const { brightBackground } = useCommonStyles();
let content = ( let content = (
<Flex <Flex
alignItems="center" alignItems="center"
border="1px solid" border="1px solid"
borderColor="green.600" borderColor="green.600"
background={brightBackground}
transition="all 0.2s"
borderRadius="full" borderRadius="full"
boxShadow="md" boxShadow="md"
paddingLeft="2" paddingLeft="2"

View file

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { Box, Heading } from "@chakra-ui/react"; import { Box, Heading, useColorModeValue } from "@chakra-ui/react";
/** /**
* Delay hides its content and first, then shows it after the given delay. * Delay hides its content and first, then shows it after the given delay.
@ -88,6 +88,12 @@ export function ErrorMessage({ children }) {
return <Box color="red.400">{children}</Box>; return <Box color="red.400">{children}</Box>;
} }
export function useCommonStyles() {
return {
brightBackground: useColorModeValue("white", "gray.700"),
};
}
/** /**
* safeImageUrl returns an HTTPS-safe image URL for Neopets assets! * safeImageUrl returns an HTTPS-safe image URL for Neopets assets!
*/ */