Add contribution graph mode#78
Conversation
- Add 'mode' setting ('default' | 'graph') to plugin settings
- Create ContributionGraph.svelte component with GitHub-style grid layout
- Update HabitTracker.svelte to conditionally render graph mode
- Add CSS styles for contribution graph cells, labels, and layout
- Add Display mode dropdown to plugin settings tab
Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
…t column layout The template previously iterated dayIndex (outer) then weeks (inner), which with CSS grid-auto-flow:column placed all Mondays in the first columns, all Tuesdays next, etc. Now iterates weeks (outer) then days (inner) so each column correctly shows Mon through Sun of a single week, matching GitHub's contribution graph layout. Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
Add contribution graph mode
Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
Update documentation to reflect changes made with the latest PR, adding GitHub contribution graph mode.
|
I’m not able to look at it this week. I did test it quickly the day you made it and noticed that the months are not aligned with when the months actually start. Try putting a full year and you will se 13 month headers. I’ll review it properly next week. I love github’s graph but TBH I’m not sure how I feel about the current implementation in HT21. You/we’d need to figure out how to show streaks and multiple habits in one tracker. Plus look all the other features and params and see if they are supported. I hope this helps keep the ball rolling until I’m back. |
|
@zincplusplus Thank you for the feedback. I'll try and implement some of what you mentioned this weekend 👍 |
Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
…contribution-graph Add streak functionality to contribution graph mode
Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
Fix misaligned month labels in contribution graph
…atchLineLength for graph mode Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
…xes only Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com>
…between-modes Refactor some of the logic
|
Quick update on the contribution graph PR. I’ve made several improvements since your initial feedback:
One thing I’d like to clarify from your earlier comment about “multiple habits in one tracker.” Right now, if a folder is used as the path, each habit renders as its own contribution graph, one after the other. For example: This produces a stack of graphs, one per habit, which seems consistent with how the default row mode displays multiple habits. Is this the behavior you had in mind? Happy to adjust the implementation if needed :)) |
|
hey. checked it out. I appreciate the enthusiasm for contributing, and no judgment on using AI to write code (I do it too). The issue is that the last update shows it didn't fully grasp how the existing features work, which ends up creating more back-and-forth than necessary for both of us.
I haven't dug into the code yet, but I think getting these right first would be a solid step forward. Happy to clarify anything. |
|
Thanks again for the feedback! I genuinely do appreciate it. I really care about getting this right, and I'll 100% keep trying. Might take a while, but I will get back to you when it's ready 🫡 |
Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com> Agent-Logs-Url: https://github.com/MySTerY1747/habit-tracker/sessions/5a367acc-25ff-4f0b-aa91-27ad9274fa36
Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com> Agent-Logs-Url: https://github.com/MySTerY1747/habit-tracker/sessions/5a367acc-25ff-4f0b-aa91-27ad9274fa36
Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com> Agent-Logs-Url: https://github.com/MySTerY1747/habit-tracker/sessions/fadb6402-0dfd-41ab-978a-f01a098981fb
Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com> Agent-Logs-Url: https://github.com/MySTerY1747/habit-tracker/sessions/9b390aa1-7c7a-4f37-9e4e-9ce59ada61b0
…d marker/badge tuning Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com> Agent-Logs-Url: https://github.com/MySTerY1747/habit-tracker/sessions/71e4da22-7342-4e2a-8b57-2278a4802c0e
…, and fix streak badge legibility Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com> Agent-Logs-Url: https://github.com/MySTerY1747/habit-tracker/sessions/321489ba-9d01-46d1-919a-12f5710950c8
Co-authored-by: MySTerY1747 <98713042+MySTerY1747@users.noreply.github.com> Agent-Logs-Url: https://github.com/MySTerY1747/habit-tracker/sessions/11f48337-660c-4019-a685-67dd51c6ce35
#### Core functionality - Implemented **streak support** in graph mode using a cleaner, consistent approach aligned with default mode logic - Added **support for all existing tracker settings** (`path`, date range options, `color`, `maxGap`, `showStreaks`, etc.) - Ensured **feature parity with default mode** where applicable #### Visual and UX improvements - Added **ghost dots** for upcoming due days, now correctly respecting the habit `color` - Implemented **“today” highlighting**, including fixes for visibility and clipping issues - Reworked **streak visualization**: - Removed emoji-based footer (🔥🏆) to match minimalist design - Introduced **in-cell streak numbers** with improved sizing, contrast, and readability - Fixed rendering issues (no more artifacts or inconsistent backgrounds) - Improved **gap day rendering (`maxGap`)**: - Gap days are now clearly part of a streak while remaining visually distinct - Uses color-based variations instead of neutral grey/white - Handles edge cases like very light/white colors #### Layout and styling - Fixed **month header alignment**: - Month labels now correctly align with week-based grid columns - Resolved overlapping labels and incorrect month placement (e.g. December appearing before January) - Adjusted **cell sizing and overall graph scale** for better readability and spacing - Ensured **habit name styling matches default mode** - Matched **header font size and colors** with default mode - Removed **weekday labels (Mon/Wed/Fri)** for a cleaner look - Ensured **graphs scroll in sync** when multiple habits are displayed #### Bug fixes and consistency - Fixed **ghost dot color regression** - Fixed **streak number contrast issues** (no more hardcoded black/white mismatches) - Fixed **cell rendering inconsistencies** (solid fills, no visual artifacts) - Ensured **consistent behavior across custom date ranges** (`daysToShow`, `firstDisplayedDate`, `lastDisplayedDate`) - Verified correct behavior with: - Single and multiple habits - Large date ranges (e.g. 180–365 days) - `maxGap` configurations - Streaks enabled/disabled
|
Hello @zincplusplus! I've made a lot of changes, and would love your feedback.
Core functionality
Visual and UX improvements
Layout and styling
I have been using this modified version of the plugin daily now, and it has brought me so muc value. I really want to work on this for as long as needed, so that people can start using it. Any feedback would be greatly appreciated! |
|
Hey @zincplusplus Have you had any time to view the above changes? I'd really appreciate any feedback :)) |
|
I'll try over the weekend. I'm curios to see it because I tired in the past and couldn't pull it off. But so far work need all my attention |
|
Things have been hectick on this side of the screen. I'm sorry you had to wait so long for a reply. I finally got around to test it and here are my findings: Blocking
Minor
|
|
Sorry for the slow development, had some personal things get in the way lately. @psxvoid As for the graph mode you're showing, I'm not sure I understand what's wrong? If you increase the number of days shown to a larger number (say ~180), it should look more like the screenshots I have provided above. I am planning to make some further changes soon based on the feedback I got. |
Don't be sorry, it's free and open source, thanks for your efforts! :)
Yep, this is the case, setting it to 180 "fixes" it. I just wasn't expecting it to look likes this for |
|
Thank you for the feedback! I genuinely really appreciate it. I'll be sure to bear this in mind when I sit down and work on this again (hopefully next week). Hope you have a very nice day. |



Goal
Added a new
graphdisplay mode, that renders habits in a GitHub-style contribution graph: weeks as columns, and days of the week as rows.Changes
src/ContributionGraph.svelte: New components that build a week by day grid from the date range given.src/HabitTracker.svelte: Adds in amodesetting, which renders the output as a contribution graph ifmode === 'graph'src/main.ts: Adds a new setting to the page,mode, which is either set todefaultorgraphstyles.css: Add CSS grid layout for the contribution graph.Usage
The usage works almost exactly the same way as it did before, but there's a new option that users can add, to indicate whether to use default mode or contribution graph mode:
{ "path": "habits", "mode": "graph" }Screenshot