Lines aren't connecting, hexagons look not like hexagons at all, waves are wierd double…
- User
Lines aren't connecting, hexagons look not like hexagons at all, waves are wierd double arcs, circles has a wierd dot in them and they are touching. fix import React, { useState, createContext, useContext } from "react"; import { Box } from "@mui/material"; import { ThemeContext } from "./Theme";
export const PatternContext = createContext({ currentPattern: "none", setCurrentPattern: () => {}, patterns: {}, });
const createRGBA = (hex, opacity = 0.1) => { const r = parseInt(hex.slice(1, 3), 16); const g = parseInt(hex.slice(3, 5), 16); const b = parseInt(hex.slice(5, 7), 16); return
rgba(${r}, ${g}, ${b}, ${opacity}); };const createPatterns = (themeColor, isDark) => { const baseColor = isDark ? "rgba(255, 255, 255, 0.07)" : createRGBA(themeColor, 0.15);
return { none: { name: "None", pattern: "none", }, dots: { name: "Dots", pattern:
radial-gradient(${baseColor} 1.5px, transparent 1.5px), }, grid: { name: "Grid", pattern:linear-gradient(${baseColor} 1px, transparent 1px), linear-gradient(to right, ${baseColor} 1px, transparent 1px), }, diagonal: { name: "Diagonal Lines", pattern:repeating-linear-gradient( 45deg, transparent, transparent 9px, ${baseColor} 9px, ${baseColor} 10px ), }, circles: { name: "Circles", pattern:repeating-radial-gradient( circle, ${baseColor} 0, ${baseColor} 1px, transparent 1px, transparent 20px ), }, waves: { name: "Waves", pattern:repeating-radial-gradient( ellipse at 50% 100%, transparent 0, transparent 10px, ${baseColor} 10px, ${baseColor} 11px ), repeating-radial-gradient( ellipse at 50% 0%, transparent 0, transparent 10px, ${baseColor} 10px, ${baseColor} 11px ), }, hexagons: { name: "Hexagons", pattern:linear-gradient(60deg, ${baseColor} 25%, transparent 25.5%), linear-gradient(-60deg, ${baseColor} 25%, transparent 25.5%), linear-gradient(-120deg, ${baseColor} 25%, transparent 25.5%), linear-gradient(120deg, ${baseColor} 25%, transparent 25.5%), linear-gradient(60deg, transparent 75%, ${baseColor} 75.5%), linear-gradient(-60deg, transparent 75%, ${baseColor} 75.5%), linear-gradient(-120deg, transparent 75%, ${baseColor} 75.5%), linear-gradient(120deg, transparent 75%, ${baseColor} 75.5%), }, }; };export const PatternProvider = ({ children }) => { const [currentPattern, setCurrentPattern] = useState("grid");
return ( <PatternContext.Provider value={{ currentPattern, setCurrentPattern }}> {children} </PatternContext.Provider> ); };
export const BackgroundPattern = () => { const { currentPattern } = useContext(PatternContext); const { currentTheme, isDarkMode, themes } = useContext(ThemeContext);
- Assistant
Let's address the issues you've mentioned related to how the patterns (lines, hexagons, circles, and the wave) are not displaying correctly. Below are some suggestions to improve each pattern and address the problems you are experiencing.
- User
full code
- Assistant
- User
make 5 different variation fixes that might be good
- Assistant