Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added screenshot-16bit-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot-original-theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
167 changes: 167 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -2288,3 +2288,170 @@
word-break: break-all;
overflow-x: auto;
}

/* ===== 16-bit SNES Theme Overrides ===== */
.theme-retro16 .aurora {
display: none;
}

.theme-retro16 .brand-name {
font-weight: 400;
font-size: 10px;
letter-spacing: 1px;
color: var(--snes-gold, #f0c040);
background: none;
-webkit-background-clip: unset;
background-clip: unset;
animation: none;
}

.theme-retro16 .pill-btn {
border-radius: var(--r-m);
font-size: 11px;
font-weight: 400;
}

.theme-retro16 .pill-btn:not(.soft):not(.ghost) {
background: linear-gradient(135deg, var(--snes-gold, #f0c040), var(--snes-orange, #e89848));
color: #0a0a14;
border: none;
}

.theme-retro16 .controls {
border-radius: var(--r-m) var(--r-m) 0 0;
border-top: 1px solid var(--border-1);
}

.theme-retro16 .chip {
border-radius: var(--r-s);
border-width: 1px;
}

.theme-retro16 .chip.selected {
border-color: var(--accent);
background: var(--accent-soft);
box-shadow: 0 0 12px var(--accent-glow);
}

.theme-retro16 .swatch {
border-radius: var(--r-s);
}

.theme-retro16 .toggle {
border-radius: var(--r-s);
}

.theme-retro16 .sheet {
border-radius: var(--r-l) var(--r-l) 0 0;
border: 1px solid var(--border-1);
}

.theme-retro16 .sheet-grab span {
border-radius: var(--r-s);
}

.theme-retro16 .text-input {
border-radius: var(--r-s);
}

.theme-retro16 .toast {
border-radius: var(--r-m);
}

.theme-retro16 .code-block {
border-radius: var(--r-s);
}

.theme-retro16 .stage::before {
border-radius: var(--r-m);
}

.theme-retro16 .stage-inner {
border-radius: var(--r-m);
}

.theme-retro16 .spinner {
border-radius: 50%;
}

.theme-retro16 .startup-loader {
background: linear-gradient(145deg, var(--bg-0), var(--bg-1));
}

.theme-retro16 .startup-loader__mark::before {
border-radius: var(--r-l);
background: linear-gradient(135deg, var(--snes-gold, #f0c040), var(--snes-orange, #e89848));
border: none;
box-shadow: 0 4px 20px rgba(240, 192, 64, 0.3);
transform: none;
}

.theme-retro16 .startup-loader__orbit,
.theme-retro16 .startup-loader__spark {
display: none;
}

.theme-retro16 .startup-loader__logo path {
fill: var(--snes-black, #0a0a14);
stroke: var(--snes-black, #0a0a14);
}

.theme-retro16 .startup-loader__wordmark {
font-family: 'Press Start 2P', monospace;
font-size: clamp(16px, 4vw, 22px);
font-weight: 400;
letter-spacing: 1px;
}

.theme-retro16 .startup-loader__wordmark strong {
background: none;
color: var(--snes-gold, #f0c040);
-webkit-background-clip: unset;
background-clip: unset;
font-weight: 400;
}

.theme-retro16 .startup-loader__progress {
border-radius: var(--r-s);
border: 1px solid var(--border-1);
}

.theme-retro16 .startup-loader__progress span {
background: linear-gradient(90deg, var(--snes-gold, #f0c040), var(--snes-orange, #e89848));
border-radius: var(--r-s);
box-shadow: 0 0 8px rgba(240, 192, 64, 0.4);
}

/* Theme toggle button */
.theme-toggle {
display: flex;
align-items: center;
justify-content: center;
width: 34px;
height: 34px;
border-radius: 50%;
border: 1px solid var(--border-1);
background: var(--surface-2);
color: var(--text-2);
cursor: pointer;
transition: all 0.2s var(--ease-out);
font-size: 16px;
padding: 0;
}

.theme-toggle:hover {
background: var(--surface-3);
color: var(--text-1);
border-color: var(--border-2);
}

.theme-retro16 .theme-toggle {
border-radius: var(--r-s);
border: 1px solid var(--snes-gold, #f0c040);
color: var(--snes-gold, #f0c040);
background: transparent;
}

.theme-retro16 .theme-toggle:hover {
background: rgba(240, 192, 64, 0.15);
}
71 changes: 71 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,43 @@ function longShadow(color, depth, angle) {
}).join(', ')
}

function hexToHsl(hex) {
let r = parseInt(hex.slice(1, 3), 16) / 255
let g = parseInt(hex.slice(3, 5), 16) / 255
let b = parseInt(hex.slice(5, 7), 16) / 255
const max = Math.max(r, g, b), min = Math.min(r, g, b)
let h = 0, s = 0, l = (max + min) / 2
if (max !== min) {
const d = max - min
s = l > 0.5 ? d / (2 - max - min) : d / (max + min)
if (max === r) h = ((g - b) / d + (g < b ? 6 : 0)) / 6
else if (max === g) h = ((b - r) / d + 2) / 6
else h = ((r - g) / d + 4) / 6
}
return [Math.round(h * 360), Math.round(s * 100), Math.round(l * 100)]
}

function hslToHex(h, s, l) {
s /= 100; l /= 100
const a = s * Math.min(l, 1 - l)
const f = (n) => {
const k = (n + h / 30) % 12
const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)
return Math.round(255 * color).toString(16).padStart(2, '0')
}
return `#${f(0)}${f(8)}${f(4)}`
}

function darkenColor(hex, amount) {
const [h, s, l] = hexToHsl(hex)
return hslToHex(h, s, Math.max(0, l - amount * 100))
}

function lightenColor(hex, amount) {
const [h, s, l] = hexToHsl(hex)
return hslToHex(h, s, Math.min(100, l + amount * 100))
}

function CurvedText({ text, mode, bend, style }) {
const pathId = `fontwow-path-${mode}`
const curve = Math.max(-90, Math.min(90, bend))
Expand Down Expand Up @@ -211,6 +248,7 @@ const defaultState = {
const defaultAppSettings = {
lang: 'fa',
themeColor: '#8b5cf6',
retroTheme: false,
}

function Sheet({ title, onClose, tall, children }) {
Expand Down Expand Up @@ -511,6 +549,14 @@ export default function App() {
document.documentElement.lang = appSettings.lang
}, [appSettings.lang])

useEffect(() => {
if (appSettings.retroTheme) {
document.documentElement.classList.add('theme-retro16')
} else {
document.documentElement.classList.remove('theme-retro16')
}
}, [appSettings.retroTheme])

const updateLayer = useCallback((id, patch) => {
update((current) => ({
layers: current.layers.map((layer) => (layer.id === id ? { ...layer, ...patch } : layer)),
Expand Down Expand Up @@ -1207,6 +1253,23 @@ export default function App() {
effectStyle = {
textShadow: `0 0 6px ${state.color}, 0 0 14px ${state.color}, 0 0 28px ${state.color}, 0 0 48px ${state.color}`,
}
} else if (state.effect === 'retro16') {
const darker = darkenColor(state.color, 0.4)
const lighter = lightenColor(state.color, 0.3)
effectStyle = {
textShadow: [
`-2px -2px 0px ${darker}`,
`2px -2px 0px ${darker}`,
`-2px 2px 0px ${darker}`,
`2px 2px 0px ${darker}`,
`0px -2px 0px ${darker}`,
`0px 2px 0px ${darker}`,
`-2px 0px 0px ${darker}`,
`2px 0px 0px ${darker}`,
`-1px -1px 0px ${lighter}`,
`1px 1px 2px rgba(0,0,0,0.5)`,
].join(', '),
}
}

if (state.textMaskUrl) {
Expand Down Expand Up @@ -1716,6 +1779,14 @@ export default function App() {
>
<I.IconSettings size={16} />
</button>
<button
className="theme-toggle"
onClick={() => setAppSettings((s) => ({ ...s, retroTheme: !s.retroTheme }))}
title={appSettings.retroTheme ? 'تم اصلی' : 'تم ۱۶ بیت'}
aria-label={appSettings.retroTheme ? 'Switch to original theme' : 'Switch to 16-bit theme'}
>
{appSettings.retroTheme ? '🎨' : '🎮'}
</button>
<button
className="pill-btn ghost icon-only"
onClick={() => setShowDonate(true)}
Expand Down
1 change: 1 addition & 0 deletions src/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export const TEXT_EFFECTS = [
{ id: 'none', label: 'بدون افکت' },
{ id: 'gradient', label: 'گرادیان' },
{ id: 'neon', label: 'نئون' },
{ id: 'retro16', label: '۱۶ بیت' },
]

export const TEXT_GRADIENTS = [
Expand Down
44 changes: 44 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
/* Original Theme (default) */
--bg-0: #0b0a12;
--bg-1: #14121e;
--surface-1: #191724;
Expand All @@ -22,6 +25,40 @@
--ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== 16-bit SNES Theme ===== */
.theme-retro16 {
--bg-0: #0e1621;
--bg-1: #162033;
--surface-1: #1e2d44;
--surface-2: #283d58;
--surface-3: #34506e;
--border-1: #3d5f84;
--border-2: #4d7399;
--text-1: #e8e0f0;
--text-2: #a098b8;
--text-3: #706888;
--r-s: 3px;
--r-m: 6px;
--r-l: 10px;
--r-pill: 999px;
--shadow-1: 0 2px 8px rgba(0, 0, 0, 0.3);
--shadow-pop: 0 4px 16px rgba(0, 0, 0, 0.4);
--dur-fast: 0.12s;
--dur-med: 0.2s;
--dur-slow: 0.35s;
--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
--ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
--snes-gold: #f0c040;
--snes-blue: #4888f8;
--snes-green: #50b868;
--snes-red: #e85060;
--snes-cyan: #48d8d8;
--snes-magenta: #b060d8;
--snes-orange: #e89848;
--snes-white: #f0e8f8;
--snes-black: #0a0a14;
}

* {
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
Expand All @@ -47,6 +84,13 @@ body {
user-select: none;
}

.theme-retro16 body,
body.theme-retro16 {
font-family: 'Press Start 2P', monospace;
font-size: 10px;
line-height: 1.8;
}

body.landing-mode {
overflow: auto;
position: static;
Expand Down