--- // Port of preview/pages/colors.html (layout: default) import DefaultLayout from '@shared/layouts/DefaultLayout.astro'; import Icon from '@shared/components/Icon.astro'; import site from '@data/site.json'; type ColorEntry = [string, { title: string; hex: string; abbr?: string; icon?: string }]; // Liquid iterates the site.json objects as [key, value] pairs. const colors = Object.entries(site.colors) as ColorEntry[]; const lightColors = Object.entries(site.lightColors) as ColorEntry[]; const grayColors = Object.entries(site.grayColors) as ColorEntry[]; const socialColors = Object.entries(site.socialColors) as ColorEntry[]; // Liquid: colors keys + inverted, white, transparent (pushed before the gradient loops). const gradientColors = [...Object.keys(site.colors), 'inverted', 'white', 'transparent']; ---
{ colors.map(([name, color]) => (
{color.abbr}
{color.title}
{color.hex}
)) }
{ lightColors.map(([name, color]) => (
{color.abbr}
{color.title}
{color.hex}
)) }
{ grayColors.map(([name, color]) => (
{color.abbr}
{color.title}
{color.hex}
)) }
{ socialColors.map(([name, color]) => (
{color.icon && }
{color.title}
{color.hex}
)) }

Gradient

{ gradientColors.map((color) => (
)) }
{ gradientColors.map((color) => (
)) }