Take gatelock 0.8.1: colour reads through LockConfig.palette
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
file-length / file length <= 250 lines (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Tests / test (push) Has been cancelled
release-apk / release (APK) (push) Has been cancelled

LockConfig's colours moved into a nested LockPalette record; every
_COLORS.<colour> read follows. Nothing about the gate's behaviour changed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HHCbkJWXHjtTUaqvnHRAqA
This commit is contained in:
Krzysztof Rudnicki 2026-09-12 19:59:44 +02:00
parent b3aeb4f4b7
commit 3f6a9b0ebf
15 changed files with 43 additions and 43 deletions

2
.fvmrc
View File

@ -1,3 +1,3 @@
{
"flutter": "3.47.3"
"flutter": "3.47.4"
}

View File

@ -50,7 +50,7 @@ jobs:
- uses: subosito/flutter-action@v2
with:
flutter-version: 3.47.3
flutter-version: 3.47.4
channel: stable
cache: true

View File

@ -106,7 +106,7 @@ repos:
# direct URLs for one distribution, so any pin that drifts from
# the manifest becomes an unresolvable hook environment rather
# than merely an old one.
- gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.7.3#subdirectory=gatelock
- gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.8.1#subdirectory=gatelock
- crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.1#subdirectory=crdt-sync
- freedays @ git+https://github.com/kuhyx/utils@freedays-v0.2.0#subdirectory=freedays
- mcp>=2,<3

View File

@ -203,10 +203,10 @@ packages:
dependency: "direct main"
description:
name: flutter_secure_storage
sha256: "4540927d8b37e6cc47aaa2d17b6035a2d49049e2797cb19d2bdd299bff602c67"
sha256: d87713a152ee2f255117bdbbf43da1dea1797e0551e499e0334f0c9dcfafddd2
url: "https://pub.dev"
source: hosted
version: "11.1.0"
version: "11.1.1"
flutter_secure_storage_darwin:
dependency: transitive
description:

View File

@ -2,7 +2,7 @@ name: diet_guard_app
description: "Companion phone app for diet_guard: log meals on the go."
publish_to: 'none'
version: 1.0.80+1
version: 1.0.81+1
environment:
sdk: ^3.12.2
@ -17,7 +17,7 @@ dependencies:
flutter:
sdk: flutter
flutter_local_notifications: 22.3.0
flutter_secure_storage: 11.1.0
flutter_secure_storage: 11.1.1
# One-tap sign-in for the sync account. App-side only: crdt_sync stays pure
# Dart so it keeps working on Linux desktop and headless.

View File

@ -38,12 +38,12 @@ _COLORS = LockConfig()
_NOT_LOGGED_FILL = BG
_NOT_LOGGED_OUTLINE = FG
_STATUS_COLORS = {
DayStatus.GREEN: _COLORS.success,
DayStatus.YELLOW: _COLORS.warning,
DayStatus.RED: _COLORS.danger,
DayStatus.GREEN: _COLORS.palette.success,
DayStatus.YELLOW: _COLORS.palette.warning,
DayStatus.RED: _COLORS.palette.danger,
}
_STATUS_TEXT_COLOR = _COLORS.on_fill
_MUTED = _COLORS.muted
_STATUS_TEXT_COLOR = _COLORS.palette.on_fill
_MUTED = _COLORS.palette.muted
@dataclass(frozen=True)

View File

@ -33,7 +33,7 @@ def _spin_entry(row: tk.Frame, variable: tk.StringVar) -> tk.Entry:
entry = tk.Entry(
row,
textvariable=variable,
font=(_COLORS.font_family, BODY),
font=(_COLORS.typography.font_family, BODY),
width=_ENTRY_WIDTH,
bg=_FIELD_BG,
fg=FG,
@ -65,7 +65,7 @@ def build_schedule_row(
tk.Label(
row,
text="Meals:",
font=(_COLORS.font_family, LABEL),
font=(_COLORS.typography.font_family, LABEL),
bg=BG,
fg=FG,
).pack(side="left")
@ -73,7 +73,7 @@ def build_schedule_row(
tk.Label(
row,
text="to",
font=(_COLORS.font_family, LABEL),
font=(_COLORS.typography.font_family, LABEL),
bg=BG,
fg=FG,
).pack(side="left")
@ -81,7 +81,7 @@ def build_schedule_row(
tk.Label(
row,
text="x",
font=(_COLORS.font_family, LABEL),
font=(_COLORS.typography.font_family, LABEL),
bg=BG,
fg=FG,
).pack(side="left")
@ -94,14 +94,14 @@ def build_schedule_row(
tk.Label(
parent,
textvariable=vars_.schedule.times,
font=(_COLORS.font_family, LABEL),
font=(_COLORS.typography.font_family, LABEL),
bg=BG,
fg=FG,
).pack(pady=(0, XS))
status_label = tk.Label(
parent,
textvariable=vars_.schedule.status,
font=(_COLORS.font_family, LABEL),
font=(_COLORS.typography.font_family, LABEL),
bg=BG,
fg=FG,
)

View File

@ -25,9 +25,9 @@ if TYPE_CHECKING:
# used to be its own hardcoded copy of _gatelock_ui's private constants; now
# it reads the same shared LockConfig() directly instead.
_COLORS = LockConfig()
_MUTED = _COLORS.muted
_FIELD_BG = _COLORS.field_bg
_ACCENT = _COLORS.accent
_MUTED = _COLORS.palette.muted
_FIELD_BG = _COLORS.palette.field_bg
_ACCENT = _COLORS.palette.accent
# calendar.monthcalendar never returns more than 6 weeks for any month.
_MONTH_ROWS = 6

View File

@ -75,5 +75,5 @@ def _style_notebook(root: tk.Misc) -> None:
style.map(
"TNotebook.Tab",
background=[("selected", _ACCENT)],
foreground=[("selected", _COLORS.on_fill)],
foreground=[("selected", _COLORS.palette.on_fill)],
)

View File

@ -60,14 +60,14 @@ def _build_budget_row(
tk.Label(
row,
text="Daily budget (kcal):",
font=(_COLORS.font_family, LABEL),
font=(_COLORS.typography.font_family, LABEL),
bg=BG,
fg=FG,
).pack(side="left")
entry = tk.Entry(
row,
textvariable=vars_.budget,
font=(_COLORS.font_family, BODY),
font=(_COLORS.typography.font_family, BODY),
width=8,
bg=_FIELD_BG,
fg=FG,
@ -87,7 +87,7 @@ def _build_budget_row(
status_label = tk.Label(
parent,
textvariable=vars_.budget_status,
font=(_COLORS.font_family, LABEL),
font=(_COLORS.typography.font_family, LABEL),
bg=BG,
fg=FG,
)
@ -113,7 +113,7 @@ def _build_month_nav(
tk.Label(
row,
textvariable=vars_.month_label,
font=(_COLORS.font_family, LABEL, "bold"),
font=(_COLORS.typography.font_family, LABEL, "bold"),
bg=BG,
fg=FG,
width=16,
@ -136,7 +136,7 @@ def _build_grid(parent: tk.Frame) -> list[tk.Label]:
tk.Label(
weekday_row,
text=label,
font=(_COLORS.font_family, CAPTION, "bold"),
font=(_COLORS.typography.font_family, CAPTION, "bold"),
bg=BG,
fg=_MUTED,
width=4,
@ -150,7 +150,7 @@ def _build_grid(parent: tk.Frame) -> list[tk.Label]:
cell = tk.Label(
grid_frame,
text="",
font=(_COLORS.font_family, CAPTION),
font=(_COLORS.typography.font_family, CAPTION),
width=4,
height=2,
bg=BG,
@ -173,7 +173,7 @@ def build_calendar_frame(
tk.Label(
frame,
text="📅 History",
font=(_COLORS.font_family, TITLE, "bold"),
font=(_COLORS.typography.font_family, TITLE, "bold"),
bg=BG,
fg=_ACCENT,
).pack(pady=(SM, 0))
@ -200,21 +200,21 @@ def build_calendar_frame(
tk.Label(
frame,
textvariable=vars_.streaks,
font=(_COLORS.font_family, LABEL, "bold"),
font=(_COLORS.typography.font_family, LABEL, "bold"),
bg=BG,
fg=FG,
).pack(pady=(SM, 0))
tk.Label(
frame,
textvariable=vars_.ytd,
font=(_COLORS.font_family, CAPTION),
font=(_COLORS.typography.font_family, CAPTION),
bg=BG,
fg=_MUTED,
).pack(pady=(XS, 0))
tk.Label(
frame,
textvariable=vars_.averages,
font=(_COLORS.font_family, CAPTION),
font=(_COLORS.typography.font_family, CAPTION),
bg=BG,
fg=_MUTED,
).pack(pady=(XS, SM))

View File

@ -103,7 +103,7 @@ def build_suggestion_box(parent: tk.Frame) -> tk.Listbox:
bg=_FIELD_BG,
fg=FG,
selectbackground=_ACCENT,
selectforeground=_COLORS.on_fill,
selectforeground=_COLORS.palette.on_fill,
activestyle="none",
# Was highlightthickness=0, which removed the focus ring entirely. The
# list *is* arrow-key navigable, so it was keyboard-usable with no

View File

@ -44,13 +44,13 @@ from diet_guard._gatelock_ui_types import (
# already import them by name; they now track LockConfig instead of a
# separate, driftable copy.
_COLORS = LockConfig()
BG = _COLORS.bg
FG = _COLORS.fg
ERR = _COLORS.danger
_ACCENT = _COLORS.accent
_FIELD_BG = _COLORS.field_bg
_MUTED = _COLORS.muted
_FONT = _COLORS.font_family
BG = _COLORS.palette.bg
FG = _COLORS.palette.fg
ERR = _COLORS.palette.danger
_ACCENT = _COLORS.palette.accent
_FIELD_BG = _COLORS.palette.field_bg
_MUTED = _COLORS.palette.muted
_FONT = _COLORS.typography.font_family
# Number of food-bank / staple / OFF suggestions shown in the picker list.
SUGGESTION_ROWS = 5
# Grams a label's macros are assumed to describe when the "per" field is blank.

View File

@ -130,7 +130,7 @@ class TestFocusRingIsVisible:
against ``bg`` the moment it took focus.
"""
kwargs = _gatelock_ui._COLORS.focus_kwargs()
assert kwargs["highlightcolor"] == _gatelock_ui._COLORS.accent
assert kwargs["highlightcolor"] == _gatelock_ui._COLORS.palette.accent
assert kwargs["highlightcolor"] != "#000000"
assert int(kwargs["highlightthickness"]) > 0

View File

@ -4,7 +4,7 @@ version = "1.0.0"
description = "Tkinter/systemd log-to-unlock meal gate with calorie/macro budget tracking"
requires-python = ">=3.14"
dependencies = [
"gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.7.3#subdirectory=gatelock",
"gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.8.1#subdirectory=gatelock",
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.1#subdirectory=crdt-sync",
"freedays @ git+https://github.com/kuhyx/utils@freedays-v0.2.0#subdirectory=freedays",
"requests==2.34.2",

View File

@ -5,7 +5,7 @@ codespell==2.4.3
coverage==7.16.0
crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.9.1#subdirectory=crdt-sync
freedays @ git+https://github.com/kuhyx/utils@freedays-v0.2.0#subdirectory=freedays
gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.7.3#subdirectory=gatelock
gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.8.1#subdirectory=gatelock
mcp==2.2.0
mypy==2.3.1
pre-commit==4.6.2