Skip to content

Commit 2e9cedd

Browse files
committed
fix: add Projects to Today tab, show heartbeat counts, and use time-based heatmap colors
1 parent d56caf3 commit 2e9cedd

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

lua/codeme/highlights.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ function M.setup()
88
vim.api.nvim_set_hl(0, "exred", { fg = colors.red, bold = true })
99
vim.api.nvim_set_hl(0, "exyellow", { fg = colors.yellow, bold = true })
1010
vim.api.nvim_set_hl(0, "exblue", { fg = colors.blue, bold = true })
11+
vim.api.nvim_set_hl(0, "excyan", { fg = colors.cyan, bold = true })
12+
vim.api.nvim_set_hl(0, "exmagenta", { fg = colors.magenta, bold = true })
1113
vim.api.nvim_set_hl(0, "commentfg", { fg = colors.comment })
1214
vim.api.nvim_set_hl(0, "linenr", { fg = colors.linenr })
1315

@@ -62,6 +64,8 @@ function M.get_colors()
6264
red = "#f7768e",
6365
yellow = "#e0af68",
6466
blue = "#7aa2f7",
67+
cyan = "#7dcfff",
68+
magenta = "#bb9af7",
6569
comment = "#565f89",
6670
linenr = "#3b4261",
6771

@@ -93,6 +97,8 @@ function M.get_colors()
9397
red = "#d73a49",
9498
yellow = "#e36209",
9599
blue = "#0366d6",
100+
cyan = "#1b7c83",
101+
magenta = "#6f42c1",
96102
comment = "#6a737d",
97103
linenr = "#d1d5da",
98104

lua/codeme/profile.lua

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,29 @@ local function tab_today()
124124
table.insert(lines, { { " 💻 No activity yet. Start coding!", "commentfg" } })
125125
end
126126

127+
-- Projects (today)
128+
if ts.projects and next(ts.projects) then
129+
local items = {}
130+
for name, stat in pairs(ts.projects) do
131+
items[#items + 1] = { name = name, time = stat.time or 0, lines = stat.lines or 0 }
132+
end
133+
table.sort(items, function(a, b)
134+
return a.time > b.time
135+
end)
136+
137+
table.insert(lines, {})
138+
table.insert(lines, { { " 🔥 Projects", "exgreen" } })
139+
table.insert(lines, {})
140+
for i = 1, math.min(3, #items) do
141+
local it = items[i]
142+
table.insert(lines, {
143+
{ " " .. it.name, i == 1 and "excyan" or "commentfg" },
144+
{ " " .. fmt_time(it.time), "normal" },
145+
{ " (" .. fmt_num(it.lines) .. " lines)", "commentfg" },
146+
})
147+
end
148+
end
149+
127150
-- Hourly activity
128151
local ha = ts.hourly_activity
129152
if ha and next(ha) then
@@ -141,7 +164,11 @@ local function tab_today()
141164
end
142165
local pct = math.floor(sum / max * 100)
143166
local hl = pct > 60 and "exgreen" or pct > 30 and "exyellow" or "commentfg"
144-
table.insert(lines, { { " " .. b[1] .. " ", "commentfg" }, { progress(pct, 25), hl } })
167+
table.insert(lines, {
168+
{ " " .. b[1] .. " ", "commentfg" },
169+
{ progress(pct, 25), hl },
170+
{ string.format(" %3d%% (%d events)", pct, sum), "commentfg" },
171+
})
145172
end
146173
end
147174
end

0 commit comments

Comments
 (0)