feature: curated subject colors with quick-pick in the timetable color dialog - #549
Open
13732348243521734 wants to merge 1 commit into
Open
Conversation
…r dialog
Applied from an external patch (subject-colors.patch), with two fixes
made before applying:
- Hardcoded German 'Vorschläge' label replaced with
AppLocalizations.of(context).timetableColorSuggestions (DE+EN arb
keys added) -- the rest of this dialog already goes through
AppLocalizations, this string didn't and would have broken for
English users.
- SubjectColors' doc comment claimed normalize("Bio (GK)") resolves
to the same key as "bio" -- traced through the actual algorithm and
that's false (it produces "biogk", which matches nothing). Doc
comment rewritten to describe the real behavior (exact match after
stripping punctuation/case, no token extraction) and to note the
practical mitigating factor: TimetableSubject.name from liblanis is
normally the bare portal-parsed abbreviation, with course/group
qualifiers already split into a separate `badge` field upstream, so
the common case is expected to match -- schools whose Stundenplan
display settings embed course info directly into the subject name
may see more hash-color fallbacks.
Behavior: getColorForLesson() now tries, in order, (1) the user's own
saved per-lesson color, (2) a curated color from
assets/subject_colors.json matched by normalized subject-name alias,
(3) the existing hash-based RandomColor fallback. The color-picker
dialog gets a row of quick-pick swatches (primary + alternatives) for
the matched subject, still allowing the free-form picker below it.
SubjectColors.ensureLoaded() awaited once at startup in main.dart so
lookups are synchronous afterwards; falls back to an empty table
(never throws) if the asset can't be loaded/parsed.
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.
getColorForLesson() now tries, in order:
The color picker dialog now shows a row of quick-pick swatches (primary + alternatives) for the matched subject, alongside the existing free-form picker below.
lib/utils/subject_colors.dart is partially AI-generated but was manually tested