Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Enhance accent color support in Tailwind configuration and components

Bill Yang30d66bd9b239
diff --git a/client/src/app/[site]/components/shared/StandardCard.tsx b/client/src/app/[site]/components/shared/StandardCard.tsx
index fd06aca4d..991b139f7 100644
--- a/client/src/app/[site]/components/shared/StandardCard.tsx
+++ b/client/src/app/[site]/components/shared/StandardCard.tsx
@@ -81,7 +81,7 @@ export function StandardCard({
}
>
<div
- className="absolute inset-0 bg-fuchsia-400 py-2 opacity-30 rounded-md"
+ className="absolute inset-0 bg-accent-400 py-2 opacity-30 rounded-md"
style={{ width: `${e.percentage * ratio}%` }}
></div>
<div className="z-10 mx-2 flex justify-between items-center text-sm w-full">
@@ -146,7 +146,7 @@ export function StandardCard({
}
>
<div
- className="absolute inset-0 bg-fuchsia-400 py-2 opacity-30 rounded-md"
+ className="absolute inset-0 bg-accent-400 py-2 opacity-30 rounded-md"
style={{ width: `${e.percentage * ratio}%` }}
></div>
<div className="z-10 ml-2 mr-4 flex justify-between items-center text-sm w-full h-7">
diff --git a/client/src/app/[site]/main/components/MainSection/Chart.tsx b/client/src/app/[site]/main/components/MainSection/Chart.tsx
index 68b9e909d..e85bce9dc 100644
--- a/client/src/app/[site]/main/components/MainSection/Chart.tsx
+++ b/client/src/app/[site]/main/components/MainSection/Chart.tsx
@@ -185,7 +185,7 @@ export function Chart({
useMesh={true}
motionConfig="stiff"
enableSlices={"x"}
- colors={["hsl(var(--fuchsia-400))"]}
+ colors={["hsl(var(--accent-400))"]}
enableArea={true}
areaBaselineValue={0}
areaOpacity={0.3}
@@ -194,8 +194,8 @@ export function Chart({
id: "gradient",
type: "linearGradient",
colors: [
- { offset: 0, color: "hsl(var(--fuchsia-400))", opacity: 1 },
- { offset: 100, color: "hsl(var(--fuchsia-400))", opacity: 0 },
+ { offset: 0, color: "hsl(var(--accent-400))", opacity: 1 },
+ { offset: 100, color: "hsl(var(--accent-400))", opacity: 0 },
],
},
]}
diff --git a/client/src/app/[site]/main/components/sections/Chloropleth.tsx b/client/src/app/[site]/main/components/sections/Chloropleth.tsx
index 1b0058078..611a36a65 100644
--- a/client/src/app/[site]/main/components/sections/Chloropleth.tsx
+++ b/client/src/app/[site]/main/components/sections/Chloropleth.tsx
@@ -50,7 +50,7 @@ export function Chloropleth() {
const maxValue = Math.max(...data.data.map((d) => d.count));
return scaleLinear<string>()
.domain([0, maxValue])
- .range(["hsl(var(--fuchsia-100))", "hsl(var(--fuchsia-600))"]);
+ .range(["hsl(var(--accent-100))", "hsl(var(--accent-600))"]);
}, [data?.data]);
const style = (feature: Feature<any, any> | undefined) => {
diff --git a/client/src/app/[site]/main/components/sections/Map.tsx b/client/src/app/[site]/main/components/sections/Map.tsx
index 80c63fd44..409ca369d 100644
--- a/client/src/app/[site]/main/components/sections/Map.tsx
+++ b/client/src/app/[site]/main/components/sections/Map.tsx
@@ -67,10 +67,22 @@ export function Map() {
const dataToUse =
mapView === "countries" ? countryData?.data : subdivisionData?.data;
+ // Get computed values from CSS variables
+ const getComputedColor = (cssVar: string) => {
+ // Get the HSL values from CSS
+ const hslValues = getComputedStyle(document.documentElement)
+ .getPropertyValue(cssVar)
+ .trim();
+ return `hsl(${hslValues})`;
+ };
+
+ const startColor = getComputedColor("--accent-200");
+ const endColor = getComputedColor("--accent-500");
+
const maxValue = Math.max(...(dataToUse?.map((d) => d.count) || [0]));
return scaleLinear<string>()
.domain([0, maxValue])
- .range(["rgba(232, 121, 249, 0.3)", "rgb(232, 121, 249)"]);
+ .range([startColor, endColor]);
}, [countryData?.data, subdivisionData?.data, mapView]);
const [countriesGeoData, setCountriesGeoData] =
@@ -88,7 +100,13 @@ export function Map() {
}, []);
const handleStyle = (feature: Feature | undefined) => {
- const borderColors = ["#377eb8", "#ff7f00", "#4daf4a", "#1abc9c", "#984ea3"];
+ const borderColors = [
+ "#377eb8",
+ "#ff7f00",
+ "#4daf4a",
+ "#1abc9c",
+ "#984ea3",
+ ];
const isCountryView = mapView === "countries";
const dataKey = isCountryView
? feature?.properties?.["ISO_A2"]
@@ -229,7 +247,7 @@ export function Map() {
{tooltipContent.name}
</div>
<div>
- <span className="font-bold text-fuchsia-400">
+ <span className="font-bold text-accent-400">
{tooltipContent.count.toLocaleString()}
</span>{" "}
<span className="text-neutral-300">
diff --git a/client/src/app/globals.css b/client/src/app/globals.css
index 363921b86..7a90826b7 100644
--- a/client/src/app/globals.css
+++ b/client/src/app/globals.css
@@ -10,8 +10,6 @@ body {
:root {
--background: 0 0% 100%;
--foreground: 240 10% 3.9%;
- --card: 0 0% 100%;
- --card-foreground: 240 10% 3.9%;
--popover: 0 0% 100%;
--popover-foreground: 240 10% 3.9%;
--primary: 240 5.9% 10%;
@@ -28,6 +26,20 @@ body {
--input: 240 5.9% 90%;
--ring: 240 5.9% 10%;
--radius: 0.3rem;
+
+
+ --accent-50: var(--indigo-50);
+ --accent-100: var(--indigo-100);
+ --accent-200: var(--indigo-200);
+ --accent-300: var(--indigo-300);
+ --accent-400: var(--indigo-400);
+ --accent-500: var(--indigo-500);
+ --accent-600: var(--indigo-600);
+ --accent-700: var(--indigo-700);
+ --accent-800: var(--indigo-800);
+ --accent-900: var(--indigo-900);
+ --accent-950: var(--indigo-950);
+
/* Slate */
--slate-50: 210 40% 98%;
@@ -329,8 +341,7 @@ body {
.dark {
--background: 0 0% 7%;
--foreground: 0 0% 98%;
- --card: 240 10% 3.9%;
- --card-foreground: 0 0% 98%;
+
--popover: 240 10% 3.9%;
--popover-foreground: 0 0% 98%;
--primary: 0 0% 98%;
@@ -345,6 +356,5 @@ body {
--destructive-foreground: 0 0% 98%;
--input: 240 3.7% 15.9%;
--ring: 240 4.9% 83.9%;
-
}
}
diff --git a/client/src/components/SiteSessionChart.tsx b/client/src/components/SiteSessionChart.tsx
index 42a0a763a..aee680fb7 100644
--- a/client/src/components/SiteSessionChart.tsx
+++ b/client/src/components/SiteSessionChart.tsx
@@ -74,15 +74,15 @@ export function SiteSessionChart({
enablePoints={false}
enableArea={true}
areaOpacity={0.3}
- colors={["hsl(var(--fuchsia-400))"]}
+ colors={["hsl(var(--accent-400))"]}
theme={nivoTheme}
defs={[
{
id: "gradientA",
type: "linearGradient",
colors: [
- { offset: 0, color: "hsl(var(--fuchsia-400))", opacity: 1 },
- { offset: 100, color: "hsl(var(--fuchsia-400))", opacity: 0 },
+ { offset: 0, color: "hsl(var(--accent-400))", opacity: 1 },
+ { offset: 100, color: "hsl(var(--accent-400))", opacity: 0 },
],
},
]}
diff --git a/client/src/components/ui/button.tsx b/client/src/components/ui/button.tsx
index b4183f91e..7ab1c7144 100644
--- a/client/src/components/ui/button.tsx
+++ b/client/src/components/ui/button.tsx
@@ -14,7 +14,7 @@ const buttonVariants = cva(
secondary:
"bg-neutral-100 text-neutral-900 shadow-sm hover:bg-neutral-100/80 dark:bg-neutral-50 dark:text-neutral-800 dark:hover:bg-neutral-50/90",
accent:
- "bg-neutral-500 text-neutral-900 shadow-sm hover:bg-neutral-500/80 dark:bg-fuchsia-600 dark:text-neutral-50 dark:hover:bg-fuchsia-600/90",
+ "bg-neutral-500 text-neutral-900 shadow-sm hover:bg-neutral-500/80 dark:bg-accent-600 dark:text-neutral-50 dark:hover:bg-accent-600/90",
success:
"bg-green-500 text-neutral-50 shadow-sm hover:bg-green-500/90 dark:bg-green-900 dark:text-neutral-50 dark:hover:bg-green-900/90",
destructive:
diff --git a/client/src/components/ui/card.tsx b/client/src/components/ui/card.tsx
index 4b4eb4ff5..52f655bb3 100644
--- a/client/src/components/ui/card.tsx
+++ b/client/src/components/ui/card.tsx
@@ -33,7 +33,7 @@ const CardLoader = React.forwardRef<
stroke="3"
bg-opacity="0.1"
speed="1.4"
- color="hsl(var(--fuchsia-400))"
+ color="hsl(var(--accent-400))"
/>
</div>
);
diff --git a/client/tailwind.config.ts b/client/tailwind.config.ts
index a611f48a7..cba4b1ab0 100644
--- a/client/tailwind.config.ts
+++ b/client/tailwind.config.ts
@@ -41,6 +41,17 @@ module.exports = {
accent: {
DEFAULT: "hsl(var(--accent))",
foreground: "hsl(var(--accent-foreground))",
+ 50: "hsl(var(--accent-50))",
+ 100: "hsl(var(--accent-100))",
+ 200: "hsl(var(--accent-200))",
+ 300: "hsl(var(--accent-300))",
+ 400: "hsl(var(--accent-400))",
+ 500: "hsl(var(--accent-500))",
+ 600: "hsl(var(--accent-600))",
+ 700: "hsl(var(--accent-700))",
+ 800: "hsl(var(--accent-800))",
+ 900: "hsl(var(--accent-900))",
+ 950: "hsl(var(--accent-950))",
},
popover: {
DEFAULT: "hsl(var(--popover))",