Skip to content

Commit 93dbb38

Browse files
committed
added randomize with few hues option
1 parent beb5b3b commit 93dbb38

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

src/app/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const ThemeGenerator = () => {
5151
return (
5252
<div className="container mx-auto p-4">
5353
<h1 className="text-2xl font-bold mb-4">VS Code Theme Generator</h1>
54-
<div className="flex gap-10">
54+
<div className="flex flex-wrap lg:flex-nowrap gap-10">
5555
<div className="flex flex-col gap-4 w-full lg:w-7/12">
5656
<div className="flex gap-10 items-end">
5757
<ThemeControls />

src/components/ThemeControls.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const ThemeControls: React.FC = () => {
181181
<Button
182182
className="w-full text-xs"
183183
size="sm"
184-
onClick={() => handleRandomize(true)}
184+
onClick={() => handleRandomize(false)}
185185
>
186186
Randomize Full
187187
</Button>
@@ -200,7 +200,7 @@ const ThemeControls: React.FC = () => {
200200
<Button
201201
className="w-full text-xs"
202202
size="sm"
203-
onClick={() => handleRandomize(false)}
203+
onClick={() => handleRandomize(true)}
204204
>
205205
Randomize with Few Colors
206206
</Button>

src/lib/utils/themeColors.ts

+14-9
Original file line numberDiff line numberDiff line change
@@ -201,16 +201,21 @@ export function generateThemeColors(
201201
const ac1Hue = Color(colors.AC1).hue()
202202
const ac2Hue = Color(colors.AC2).hue()
203203

204-
const ac1AdditionalHues = generateSchemeColors(ac1Hue, scheme)
205-
const ac2AdditionalHues = generateSchemeColors(ac2Hue, scheme)
206-
console.log('AC1 additional hues: ', ac1AdditionalHues)
207-
console.log('AC2 additional hues: ', ac2AdditionalHues)
204+
let updatedSchemeHues = [...schemeHues]
205+
206+
if (!few) {
207+
const ac1AdditionalHues = generateSchemeColors(ac1Hue, scheme)
208+
const ac2AdditionalHues = generateSchemeColors(ac2Hue, scheme)
209+
console.log('AC1 additional hues: ', ac1AdditionalHues)
210+
console.log('AC2 additional hues: ', ac2AdditionalHues)
211+
212+
updatedSchemeHues = [
213+
...schemeHues,
214+
...ac1AdditionalHues,
215+
...ac2AdditionalHues,
216+
]
217+
}
208218

209-
const updatedSchemeHues = [
210-
...schemeHues,
211-
...ac1AdditionalHues,
212-
...ac2AdditionalHues,
213-
]
214219
console.log('ALL SCHEME HUES: ', updatedSchemeHues)
215220

216221
return { colors, schemeHues: updatedSchemeHues, scheme }

0 commit comments

Comments
 (0)