Jeet1994/Local-Habit-Tracker

Local Habit Tracker - made with Vibe Coding on Claude

★ 0Forks 0HTMLGitHub ↗Compare

README

🔥 STREAK — Habit Tracker

A zero-dependency, single-file habit tracking web app with beautiful consistency matrices and a dark editorial aesthetic.

HTML CSS JavaScript No Dependencies License


✨ Features

  • Track up to 5 habits — each assigned a distinct accent color
  • Daily check-ins — tap the pill button to log today's completion instantly
  • Three matrix views with different time scopes and layouts
  • Streak tracking — current streak, best streak, 7-day rate, and perfect days
  • Persistent storage — all data lives in localStorage, no backend needed
  • Zero dependencies — one self-contained HTML file, no build tools, no npm

📊 Matrix Views

365 Days — Yearly

Four quarterly panels (Q1 · Q2 · Q3 · Q4) displayed side by side.

         Q1                  Q2                  Q3                  Q4
  [habit headers]    [habit headers]    [habit headers]    [habit headers]
  Jan 01  ■ □ ■ □ □  |  Apr 01  □ ■ ■ □ ■  |  Jul 01  ■ ■ □ □ ■  |  Oct 01  □ □ ■ ■ □
  Jan 02  □ ■ □ ■ ■  |  Apr 02  ■ □ □ ■ □  |  Jul 02  □ ■ ■ □ □  |  Oct 02  ■ □ □ ■ ■
  ...                |  ...               |  ...               |  ...
  • Rows = days, Columns = habits
  • Habit names displayed as vertical column headers
  • Day labels every ~20 rows; "Today" highlighted in amber
  • Quarters: 91 · 91 · 91 · 92 days

30 Days — Monthly

Four weekly blocks (~7–8 days each) stacked vertically.

  [habit headers]
  Mon 1   ■ □ ■ □ □
  Tue 2   □ ■ □ ■ ■
  ...
  ─────────────────
  [habit headers]
  Mon 8   ■ ■ □ □ ■
  ...
  • Rows = days (with weekday + day number label), Columns = habits
  • Each block gets its own header row for easy scanning
  • Horizontal dividers between blocks
  • Parts: 8 · 7 · 7 · 8 days

7 Days — Weekly

A single horizontal grid.

             Sun  Mon  Tue  Wed  Thu  Fri  Sat
  Morning Run  ■    □    ■    ■    □    ■    □
  Read 30 min  □    ■    ■    □    ■    □    ■
  Meditate     ■    ■    □    ■    ■    □    □
  No Sugar     □    □    ■    □    □    ■    ■
  Sleep 8 hrs  ■    □    □    ■    □    ■    □
  • Rows = habits, Columns = days
  • Weekday labels above each column
  • Today's column highlighted in amber

🚀 Getting Started

No installation required. Download habit-tracker.html and open it in any modern browser:

# Clone the repo
git clone https://github.com/your-username/streak-habit-tracker.git
cd streak-habit-tracker

# Open directly
open habit-tracker.html        # macOS
start habit-tracker.html       # Windows
xdg-open habit-tracker.html    # Linux

Or serve locally:

python3 -m http.server 8080
# then visit http://localhost:8080/habit-tracker.html

🗂 Project Structure

streak-habit-tracker/
├── habit-tracker.html   # Entire app — HTML, CSS, JS in one file
└── README.md

🎨 Design

Element Choice
Display font Bebas Neue
Body font DM Sans
Monospace font DM Mono
Background #0c0c0d deep charcoal
Primary accent #f5a623 warm amber
Theme Dark, grain-overlay, glowing cells

Habit colors: Amber · Coral · Teal · Purple · Green


💾 Data & Storage

All data is stored in the browser via localStorage — no account, no server, no internet required after the initial font load.

Key Contents
sk2_habits JSON array of habit objects { id, name, color }
sk2_logs JSON object of completions { "habitId_YYYY-MM-DD": true }

Backup / restore via browser console:

// Export
copy(JSON.stringify({
  habits: JSON.parse(localStorage.sk2_habits),
  logs:   JSON.parse(localStorage.sk2_logs)
}))

// Import (paste your backup JSON as `data`)
localStorage.sk2_habits = JSON.stringify(data.habits);
localStorage.sk2_logs   = JSON.stringify(data.logs);
location.reload();

🛠 Customization

Change the habit limit — edit MAX near the top of the <script>:

const MAX = 5; // increase to allow more habits

Change matrix split sizes — edit the slice indices in renderMatrix():

// Yearly quarters (currently 91/91/91/92)
const quarters = [allDates.slice(0,91), allDates.slice(91,182), ...];

// Monthly parts (currently 8/7/7/8)
const parts = [dates.slice(0,8), dates.slice(8,15), ...];

Change accent/habit colors — edit the COLORS array:

const COLORS = ['#f5a623','#ff6b6b','#4ecdc4','#c77dff','#52c78a'];

🌐 Browser Support

Browser Support
Chrome / Edge ✅ Full
Firefox ✅ Full
Safari ✅ Full
Mobile (iOS/Android) ✅ Responsive

Requires localStorage support (all modern browsers).


🤝 Contributing

PRs welcome! Ideas for future features:

  • Export to CSV / PNG snapshot
  • Habit categories or emoji icons
  • Custom color picker
  • Weekly reminders via Web Notifications API
  • PWA / offline-first support
  • Dark/light theme toggle

📄 License

MIT — free to use, modify, and distribute.


Built with ☕ and obsessive attention to grids.

Contributors

Jeet1994

Issues