-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
1,436 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,4 @@ coverage | |
############################ | ||
.node_history | ||
.vercel | ||
website/.next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"$schema": "https://ui.shadcn.com/schema.json", | ||
"style": "new-york", | ||
"rsc": true, | ||
"tsx": true, | ||
"tailwind": { | ||
"config": "tailwind.config.ts", | ||
"css": "src/app/globals.css", | ||
"baseColor": "zinc", | ||
"cssVariables": true, | ||
"prefix": "" | ||
}, | ||
"aliases": { | ||
"components": "@/components", | ||
"utils": "@/lib/utils", | ||
"ui": "@/components/ui", | ||
"lib": "@/lib", | ||
"hooks": "@/hooks" | ||
}, | ||
"iconLibrary": "lucide" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { dirname } from 'path' | ||
import { fileURLToPath } from 'url' | ||
import { FlatCompat } from '@eslint/eslintrc' | ||
|
||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = dirname(__filename) | ||
|
||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname | ||
}) | ||
|
||
const eslintConfig = [...compat.extends('next/core-web-vitals', 'next/typescript')] | ||
|
||
export default eslintConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { NextConfig } from "next"; | ||
|
||
const nextConfig: NextConfig = { | ||
/* config options here */ | ||
}; | ||
|
||
export default nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "splashy", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev --turbopack", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint" | ||
}, | ||
"dependencies": { | ||
"@radix-ui/react-slot": "~1.1.1", | ||
"@radix-ui/react-toast": "~1.2.3", | ||
"class-variance-authority": "~0.7.1", | ||
"http-body": "~1.0.12", | ||
"lucide-react": "~0.468.0", | ||
"next": "15.1.0", | ||
"react": "^19.0.0", | ||
"react-dom": "^19.0.0", | ||
"react-dropzone": "~14.3.5", | ||
"splashy": "6.0.0-3", | ||
"sugar-high": "~0.7.5", | ||
"tailwind-merge": "~2.5.5", | ||
"tailwindcss-animate": "~1.0.7" | ||
}, | ||
"devDependencies": { | ||
"@eslint/eslintrc": "^3", | ||
"@types/node": "^20", | ||
"@types/react": "^19", | ||
"@types/react-dom": "^19", | ||
"eslint": "^9", | ||
"eslint-config-next": "15.1.0", | ||
"postcss": "^8", | ||
"tailwindcss": "^3.4.1", | ||
"typescript": "^5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** @type {import('postcss-load-config').Config} */ | ||
const config = { | ||
plugins: { | ||
tailwindcss: {}, | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import ColorVisualizer from '@/components/color-visualizer' | ||
|
||
export default function Page () { | ||
return ( | ||
<> | ||
<ColorVisualizer /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// @ts-expect-error ssh | ||
import splashy from 'splashy' | ||
|
||
const hex2rgb = (hex: string) => { | ||
const bigint = parseInt(hex.slice(1), 16) | ||
const r = (bigint >> 16) & 255 | ||
const g = (bigint >> 8) & 255 | ||
const b = bigint & 255 | ||
return { r, g, b } | ||
} | ||
|
||
const rgb2hsl = (r: number, g: number, b: number) => { | ||
r /= 255 | ||
g /= 255 | ||
b /= 255 | ||
const max = Math.max(r, g, b) | ||
const min = Math.min(r, g, b) | ||
let h = 0, | ||
s = 0 | ||
const l = (max + min) / 2 | ||
|
||
if (max !== min) { | ||
const d = max - min | ||
s = l > 0.5 ? d / (2 - max - min) : d / (max + min) | ||
switch (max) { | ||
case r: | ||
h = (g - b) / d + (g < b ? 6 : 0) | ||
break | ||
case g: | ||
h = (b - r) / d + 2 | ||
break | ||
case b: | ||
h = (r - g) / d + 4 | ||
break | ||
} | ||
h /= 6 | ||
} | ||
|
||
return { | ||
h: Math.round(h * 360), | ||
s: Math.round(s * 100), | ||
l: Math.round(l * 100) | ||
} | ||
} | ||
|
||
export const POST = async (request: Request) => { | ||
const formData = await request.formData() | ||
const file = formData.get('file') as File | ||
const bytes = await file.arrayBuffer() | ||
|
||
const palette = await splashy(Buffer.from(bytes)) | ||
|
||
const paletteWithDetails = palette.map((color: string) => { | ||
const rgb = hex2rgb(color) | ||
const hsl = rgb2hsl(rgb.r, rgb.g, rgb.b) | ||
return { | ||
hex: color, | ||
rgb: `rgb(${rgb.r}, ${rgb.g}, ${rgb.b})`, | ||
rgba: `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 1)`, | ||
hsl: `hsl(${hsl.h}, ${hsl.s}%, ${hsl.l}%)` | ||
} | ||
}) | ||
|
||
return Response.json(paletteWithDetails) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Debugger } from '@/components/debugger' | ||
import { ContainerLayout } from '@/components/layout' | ||
|
||
export default function Page () { | ||
return ( | ||
<ContainerLayout> | ||
<Debugger /> | ||
</ContainerLayout> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { FAQ } from '@/components/faq' | ||
import { ContainerLayout } from '@/components/layout' | ||
|
||
export default function Page () { | ||
return ( | ||
<ContainerLayout> | ||
<FAQ /> | ||
</ContainerLayout> | ||
) | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { BaseLayout } from '@/components/layout' | ||
|
||
export default function Layout ({ children }: { children: React.ReactNode }) { | ||
return <BaseLayout>{children}</BaseLayout> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ColorExtractor } from '@/components/color-extractor' | ||
import { ContainerLayout } from '@/components/layout' | ||
|
||
export default function Page () { | ||
return ( | ||
<ContainerLayout> | ||
<ColorExtractor /> | ||
</ContainerLayout> | ||
) | ||
} |
Oops, something went wrong.