feat: remove emphasis color and auto generate theme color

This commit is contained in:
DIYgod
2023-02-27 17:19:36 +00:00
parent e73a21ec4c
commit a629fdebae
9 changed files with 14 additions and 27 deletions
@@ -29,7 +29,7 @@ export const DashboardSidebar: React.FC<{
{children(isOpen)}
<div className="w-[1px] bg-border absolute top-0 right-0 bottom-0"></div>
<div
className="absolute top-5 -right-3 bg-accent shadow-button rounded-full cursor-pointer"
className="absolute top-5 -right-3 bg-accent rounded-full cursor-pointer"
onClick={() => setIsOpen(!isOpen)}
>
{isOpen ? (
+6 -2
View File
@@ -117,6 +117,7 @@ export const SiteHeader: React.FC<{
const [averageColor, setAverageColor] = useState<string>()
const [hoverColor, setHoverColor] = useState<string>()
const [autoThemeColor, setAutoThemeColor] = useState<string>()
useEffect(() => {
if (bannerRef?.current) {
@@ -124,7 +125,8 @@ export const SiteHeader: React.FC<{
.getColorAsync(bannerRef.current)
.then((color) => {
setAverageColor(chroma(color.hex).hex())
setHoverColor(chroma(color.hex).luminance(0.9).hex())
setHoverColor(chroma(color.hex).luminance(0.8).hex())
setAutoThemeColor(chroma(color.hex).saturate(3).luminance(0.3).hex())
})
.catch((e) => {
console.warn(e)
@@ -134,7 +136,8 @@ export const SiteHeader: React.FC<{
.getColorAsync(avatarRef.current)
.then((color) => {
setAverageColor(chroma(color.hex).luminance(0.95).hex())
setHoverColor(chroma(color.hex).luminance(0.9).hex())
setHoverColor(chroma(color.hex).luminance(0.8).hex())
setAutoThemeColor(chroma(color.hex).saturate(3).luminance(0.3).hex())
})
.catch((e) => {
console.warn(e)
@@ -148,6 +151,7 @@ export const SiteHeader: React.FC<{
<style jsx global>{`
:root {
--hover-color: ${hoverColor};
--auto-theme-color: ${autoThemeColor};
}
`}</style>
)}
+1 -1
View File
@@ -62,7 +62,7 @@ export const Button = React.forwardRef<
isAutoWidth && `is-auto-width`,
size && `is-${size}`,
`is-${variant || "primary"}`,
rounded === "full" ? "rounded-full" : "rounded-lg",
rounded === "full" ? "rounded-full" : "rounded-md",
)}
>
{children}