Skip to content

Repository files navigation

Color Match

Play onlineDeployLicense: MITTypeScriptVitePWA

A color perception game. Spin the wheel, match the target color as closely as you can, and see how good your eye really is.

Built for my daughter, who came up with most of the ideas. Inspired by color training tools seen around the web.


How to play

  1. A target color is shown on the left swatch.
  2. Drag the color wheel to pick your best match.
  3. Hit Confirm before the round timer runs out.
  4. Your accuracy is scored 0–100 based on hue and saturation distance.
  5. After 5 rounds you get a final grade (S / A / B / C / D / F).

Features

FeatureDetails
Color wheelFull HSL wheel on an HTML5 canvas — tap or drag to pick
Scoring0–100 per round; weighted by hue (70 %) and saturation (30 %)
GradingS ≥ 95 · A ≥ 85 · B ≥ 70 · C ≥ 55 · D ≥ 40 · F otherwise
Easy / HardHard mode hides the target after a 3-second countdown
Daily challengeSame 5 colors for everyone each day, seeded by day number
Streak counterTracks consecutive days you play the daily challenge
Shareable resultOne-tap share with grade, score and color emoji grid
History chartBar chart of your last 10 games
Perfect score easter eggHit 100/100 on a round → sparkles + unique sound
Color namesAfter each round, shows the nearest named color
Dark / Light themeToggle at any time
Spanish / EnglishFull UI translation
PWAInstallable, works fully offline
Haptic feedbackVibration patterns on mobile for different score ranges
Sound effectsWeb Audio API tones — no audio files

Grading scale

GradeAverage score
S95 – 100
A85 – 94
B70 – 84
C55 – 69
D40 – 54
F0 – 39

Tech stack

  • Vite + TypeScript — no framework, vanilla DOM
  • HTML5 Canvas — color wheel rendering
  • Web Audio API — procedural sound effects
  • Workbox (via vite-plugin-pwa) — service worker + offline cache
  • localStorage — highscore, history, daily record, streak, tutorial state
  • Mulberry32 PRNG — deterministic daily color seeds from the day number

Development

npm install
npm run dev # dev server at http://localhost:5173/ColorGame/
npm run build # production build → dist/
npm run preview # preview the production build

The app is deployed to GitHub Pages from the dist/ output via the Actions workflow on every push to main.


Project structure

src/
main.ts — app entry, game loop, event wiring
game.ts — Game state machine (idle → playing → scored → done)
wheel.ts — Canvas color wheel
color.ts — HSL math, scoring, grading
colornames.ts — Nearest named color lookup
daily.ts — Daily targets (seeded PRNG), share text
storage.ts — localStorage helpers (highscore, history, daily, streak)
audio.ts — Web Audio sound effects
confetti.ts — Confetti + sparkle canvas effects
tutorial.ts — First-run tutorial overlay
ui.ts — DOM manipulation layer
i18n.ts — English / Spanish translations
types.ts — Shared TypeScript types

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages