feat(theme): implement GitHub-aligned light mode with centralized col…#898
feat(theme): implement GitHub-aligned light mode with centralized col…#898hunnyboy1217 wants to merge 2 commits into
Conversation
|
Hi, @e35ventura , |
4ff965d to
fa8c9bc
Compare
|
Good job, Hope to see this in Gittensor platform. |
|
Please resolve merge conflicts. |
|
Hi, @ventura-oss , |
|
please resolve conflicts |
|
Sorry for the late reply, @ventura-oss , @e35ventura , |
f62a5a8 to
b34c42d
Compare
|
Hi, @ventura-oss , |
|
failing CI checks, please fix |
|
|
b34c42d to
970c0ba
Compare
|
|
970c0ba to
d051f3f
Compare
|
|
d051f3f to
751c07e
Compare
Hi, @e35ventura , |
809a599 to
bfbf325
Compare
|
Hi, @anderdc , |
|
Holding off on merge — this branch's base predates two fixes that have landed on
GitHub reports the PR as MERGEABLE because the text conflicts auto-resolve, but the resolution drops the recent fixes silently. Please rebase onto current Two smaller code notes for the rebase pass:
|
e35ventura
left a comment
There was a problem hiding this comment.
you are missing details on outline of cards on pull request tab on watchlist
Ok. I'll fix it asap. |
bfbf325 to
2acad7d
Compare
7d4f8bf to
f013303
Compare
Replaces hardcoded colour values across the codebase with theme.palette references and adds a light/dark mode split aligned with GitHub's design system. Highlights: - Centralised colour tokens through theme.palette.* — every component now reads colours from the theme rather than from constants. - Light mode: GitHub-aligned canvas, surface, and text tokens; dedicated highlight palette for success/warning/error chip backgrounds. - Dark mode: preserved the existing palette while routing it through the same theme structure. - Theme toggle integrated into the sidebar footer with refined link layout. - Chart colour hooks (getPositiveColor, getChartSegmentColors) so charts pick the correct mode-aware tint without local conditionals. - modeActiveTabSx helper for active/hover styling shared across filter buttons and tab controls. - Component-level adaptations: MinerCard, LeaderboardSidebar, Sidebar, AppLayout, IssueHeaderCard, IssueSubmissionsTable, BountyCard, RepositoryPRsTable, RepositoryCheckTab, RepositoryContributorsTable, RepositoriesPage, RepositoryDetailsPage, WatchlistPage, TopRepositoriesTable, ContributionTrends, FilterButton, etc.
…ites
Three additions on top of the GitHub-aligned light mode commit:
1) src/utils/themeUtils.ts — extends the existing helper with structural
exports that centralise the 'theme.palette.mode === "dark" ? X : Y'
branching pattern repeated across 30+ callsites:
- isDarkMode(theme) / isLightMode(theme) — typed predicates
- themeAware<T>(theme, dark, light) — generic value picker
- mode<T>(theme, { dark, light }) — labelled object form
- darkOnly<T>(theme, value, fallback?) — overloaded conditional
- lightOnly<T>(theme, value, fallback?) — mirror of darkOnly
- tintedText / tintedSurface / modeBorder — palette-aware tints
- getNegativeColor / getWarningColor — palette-derived selectors
- darkOnlySx / lightOnlySx — sx-fragment spreads
2) src/utils/themeContrast.ts (new) — WCAG 2.x contrast utilities so the
light-mode rollout can verify text legibility on coloured surfaces:
- parseColor / relativeLuminance / contrastRatio
- WCAG_AA_NORMAL / WCAG_AA_LARGE / WCAG_AAA_NORMAL / WCAG_AAA_LARGE
- meetsContrast(fg, bg, level, size)
- readableForegroundFor(theme, bg)
- pickHighestContrast(bg, candidates)
- ensureReadable(theme, fg, bg, level, size)
3) src/hooks/useThemedSx.ts (new) — three hooks for memoising theme-derived
values so child components don't re-render on unrelated parent updates:
- useThemedSx(builder) — single sx
- useThemedSxBatch(builders) — array of sx
- useThemedValue(selector) — non-sx values
Refactored seven high-traffic callsites to consume the new helpers:
- MinerCard, LeaderboardSidebar, Sidebar (boxShadow / hover / nav state)
- AppLayout (drawer tint colour + mobile logo filter)
- GlobalSearchBar (search-field shadow)
- RankBadge (podium colour predicate)
- ContributionTrends (3 toggle-button mode branches → mode() calls)
All helpers preserve the caller's static type via generics and have JSDoc
describing intent + a usage example.
f013303 to
a4002ef
Compare
|
Hi, @e35ventura , |
|
Auto-skipping this review pass: no CI checks have run on this branch, which usually means workflows are awaiting maintainer approval for a contributor whose GH Actions haven't been authorized yet. Once a maintainer approves and |
Summary
brightness(0)CSS filter in light mode for solid black renderingtheme.tsas named exports (CHART_COLORS,INSIGHT_COLORS,WATCHLIST_COLORS,UI_COLORS, etc.)modeActiveTabSxutility insrc/utils/themeUtils.tsreplaces repeated dark/light active-tab ternary patterns across 5+ componentsgittensorChartTheme.tsRelated Issues
Closes #881
Type of Change
Screenshots
Recording.2026-04-30.081356.mp4
Checklist
npm run formatandnpm run lint:fixhave been runnpm run buildpasses