"use client"; import { ny } from "@/lib/utils"; import { Button } from "./ui/button"; import React from "react"; import styled from "styled-components"; import { Dialog, DialogContent, DialogDescription, DialogTitle, DialogTrigger } from "@radix-ui/react-dialog"; import { DialogFooter, DialogHeader } from "./ui/dialog"; import { Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "./ui/sheet"; export const COLORS = [ "#ffaa40", "#9c40ff", "#ff40aa", "#40ffaa", "#40aaff", ]; const ThemeFormWrapper = styled.div<{ primaryColor: string, accentColor: string, secondaryColor: string, tertiaryColor: string, colorsBorder: string, dialogBg: string, }>` ${({ primaryColor, accentColor, secondaryColor, tertiaryColor, colorsBorder, dialogBg, }: { primaryColor: string; accentColor: string; secondaryColor: string; tertiaryColor: string; colorsBorder: string; dialogBg: string; }) => ` --zen-primary-color: ${accentColor}; --zen-colors-primary: ${primaryColor}; --zen-colors-secondary: ${secondaryColor}; --zen-colors-tertiary: ${tertiaryColor}; --zen-colors-border: ${colorsBorder}; --zen-dialog-background: ${dialogBg}; `} `; const defaultStyles = { primaryColor: { light: "color-mix(in srgb, var(--zen-primary-color) 50%, black 50%)", dark: "color-mix(in srgb, var(--zen-primary-color) 50%, black 50%)", }, secondaryColor: { light: "color-mix(in srgb, var(--zen-primary-color) 40%, white 60%)", dark: "color-mix(in srgb, var(--zen-primary-color) 40%, black 60%)", }, tertiaryColor: { light: "color-mix(in srgb, var(--zen-primary-color) 7%, white 93%)", dark: "color-mix(in srgb, var(--zen-primary-color) 15%, black 85%)", }, colorsBorder: { light: "color-mix(in srgb, var(--zen-colors-secondary) 90%, black 10%)", dark: "color-mix(in srgb, var(--zen-colors-secondary) 80%, black 20%)", }, dialogBg: { light: "var(--zen-colors-tertiary)", dark: "color-mix(in srgb, var(--zen-primary-color) 10%, black 90%)", }, } export default function CreateThemePage() { const [selectedColor, setSelectedColor] = React.useState(COLORS[0]); const [isDarkMode, setIsDarkMode] = React.useState(false); const [primaryColor, setPrimaryColor] = React.useState(defaultStyles.primaryColor.dark); const [secondaryColor, setSecondaryColor] = React.useState(defaultStyles.secondaryColor.dark); const [tertiaryColor, setTertiaryColor] = React.useState(defaultStyles.tertiaryColor.dark); const [colorsBorder, setColorsBorder] = React.useState(defaultStyles.colorsBorder.dark); const [dialogBg, setDialogBg] = React.useState(defaultStyles.dialogBg.dark); React.useEffect(() => { setPrimaryColor(isDarkMode ? defaultStyles.primaryColor.dark : defaultStyles.primaryColor.light); setSecondaryColor(isDarkMode ? defaultStyles.secondaryColor.dark : defaultStyles.secondaryColor.light); setTertiaryColor(isDarkMode ? defaultStyles.tertiaryColor.dark : defaultStyles.tertiaryColor.light); setColorsBorder(isDarkMode ? defaultStyles.colorsBorder.dark : defaultStyles.colorsBorder.light); setDialogBg(isDarkMode ? defaultStyles.dialogBg.dark : defaultStyles.dialogBg.light); }, [isDarkMode]); const generateThemeData = () => { let theme: any = { isDarkMode, }; // Dont add the default values if (primaryColor !== (isDarkMode ? defaultStyles.primaryColor.dark : defaultStyles.primaryColor.light)) { theme["primaryColor"] = primaryColor; } if (secondaryColor !== (isDarkMode ? defaultStyles.secondaryColor.dark : defaultStyles.secondaryColor.light)) { theme["secondaryColor"] = secondaryColor; } if (tertiaryColor !== (isDarkMode ? defaultStyles.tertiaryColor.dark : defaultStyles.tertiaryColor.light)) { theme["tertiaryColor"] = tertiaryColor; } if (colorsBorder !== (isDarkMode ? defaultStyles.colorsBorder.dark : defaultStyles.colorsBorder.light)) { theme["colorsBorder"] = colorsBorder } if (dialogBg !== (isDarkMode ? defaultStyles.dialogBg.dark : defaultStyles.dialogBg.light)) { theme["dialogBg"] = dialogBg } if (COLORS.indexOf(selectedColor) !== 0) { theme["accentColor"] = selectedColor; } return JSON.stringify(theme, null, 4); } return (

Create your theme

Create your own theme for Zen Browser and share it with the community.

If the color is chosen from the palette, the accent color will be set to the user's selection in the preferences. However, if the color is chosen from the color picker, the accent color will be the color selected.
{COLORS.map((color) => (
setSelectedColor(color)} className={ny(`w-6 h-6 mx-2 cursor-pointer rounded-md shadow-sm text-white`, selectedColor === color ? "ring-2 ring-black dark:ring-white" : "")} style={{ backgroundColor: color }} >
))}
or
setSelectedColor(e.target.value)} className="w-9 h-7 rounded cursor-pointer outline-none" />
setIsDarkMode(e.target.checked)} id="dark-mode" />

Primary color

setPrimaryColor(e.target.value)} />

Secondary color

setSecondaryColor(e.target.value)} />

Tertiary color

setTertiaryColor(e.target.value)} />

Border color

setColorsBorder(e.target.value)} />

Dialog background color

setDialogBg(e.target.value)} />
Right now, we aren't taking more color themes for the browser, until we find a way to make it more accessible for everyone. However, you can still create your own theme and share it with the community.
Theme data Copy the following JSON object and paste it into your Zen Browser theme format.
{generateThemeData()}
{/* Preview */}
); }