Repository navigation
Conversation
.total 与 .color 分隔符原来用 .secondaryLabelColor(labelColor + 50% 透明), 叠在菜单栏 vibrancy 材质上后亮度贴近底色,色相和对比度一起丢失。 - .total 改用 .labelColor(不透明,按菜单栏明暗取纯黑/纯白) - .color 分隔符改用 labelColor.withAlphaComponent(0.75) - staleAlpha 0.45 → 0.62,过期读数仍可区分但不至于看不清 实机实测(同一状态项位置,128×48px @2x): 改前 #586078 压 #6B728D = 1.31:1;改后 #F0F1F4 压 #6B728D = 4.21:1 (同一栏 Apple 原生状态项 #EFF1F5 = 4.19:1)
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the menu-bar contrast adjustments.
No open issues 🎉
What changed in this PR
This PR improves menu-bar readability by increasing contrast for total readings, separators, and stale values.
Changes:
- Uses
.labelColorinstead of.secondaryLabelColorfor total readings. - Gives color-style separators
.labelColorat 75% opacity. - Raises stale-value opacity from 45% to 62%, leaving provider-specific quota colors unchanged.
| File | Description |
|---|---|
Tokei/Sources/Tokei/MenuBarStyle.swift |
Adjusts text colors and opacity to improve menu-bar contrast. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
menuBarStyle = color时,菜单栏读数几乎看不清。实测方法:用 System Events 取状态项真实位置(
891,3,64,24pt),再按该区域精确截图(128×48px @2x),逐像素量亮度与 WCAG 对比度。#6B728D(L=0.171)#586078(L=0.106),比底色还暗,对比度 1.31:1(WCAG 正文需 4.5:1)#EFF1F5,对比度 4.19:1另一张浅色外观下的截图是
#7E7E7E压#657290,1.19:1,同一个毛病。原因
MenuBarMetricKind.nsColor的.total分支、以及.color样式的分隔符,都用了.secondaryLabelColor(等于labelColor加 50% 透明度)。半透明色叠在菜单栏的 vibrancy 材质上后,亮度刚好落在底色附近,色相和对比度一起丢失。.system样式用的是纯.white,所以经典白没这个问题;.symbols/.dots也早就只给图标上色、数字统一用.labelColor。改动
MenuBarStyle.swift:224—.total由.secondaryLabelColor改为.labelColor(不透明,按菜单栏明暗自动取纯黑/纯白)MenuBarStyle.swift:659—.color样式的·分隔符改为NSColor.labelColor.withAlphaComponent(0.75)(比主数字略弱,但不会糊进底色)MenuBarStyle.swift:749—staleAlpha0.45 → 0.62(过期读数仍然能和新鲜读数区分开,但不至于看不清)验证
本地构建(arm64),实机截图,同一状态项位置:
#6B728D#586078#6B728D#F0F1F4#EFF1F5改后文字亮度与系统原生状态项同一档。
过期读数按新系数模拟合成(同一底色):0.45 → 2.08:1,0.62 → 2.64:1。
未覆盖
.color/.compact下额度数字仍用claudeColor/codexColor/grokColor(实测 1.85:1 / 2.05:1 / 2.15:1),本 PR 不动,避免超出范围。如果需要可以另开 PR 统一成.labelColor+ 彩色图标。staleAlpha这两处在本地没能实机触发(当前只显示「今日总量」,额度数据未同步;读数也是新鲜的),只做了代码级修改。