[major] feat(color)!: migrate ThemeProvider to ktsu.Semantics.Color (gamma fix)#29
Merged
Merged
Conversation
…ics.Color Regenerate ApiCompat suppression baselines for the removed public color types, update README/CLAUDE docs to the Color-based API, and note the gamma-correctness fix. Completes the PerceptualColor -> Color migration.
|
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.




Summary
Migrates
ktsu.ThemeProvideroff its in-house color types onto the newktsu.Semantics.Colorpackage (2.3.0), and fixes a long-standing sRGB-as-linear gamma bug in the process. Breaking change → major version bump ([major]).The public currency type
PerceptualColorbecomesktsu.Semantics.Color.Color(linear RGB + alpha) acrossISemanticTheme,SemanticColorMapper, the 38 themes, andImGuiPaletteMapper.The gamma fix
ThemeProvider previously loaded sRGB hex bytes as if they were linear (no decode) and fed them straight into the Oklab matrix and WCAG luminance. Now hex is parsed with
Color.FromHex(correct sRGB→linear) and emitted to ImGui viaToSrgbVector4():What changed (5 commits)
RgbColor/SRgbColor/OklabColor/PerceptualColor/ColorMath/AccessibilityLevel; rewroteSemanticColorMapper+ColorRangeontoColor(algorithm preserved verbatim — gamut chroma search, lightness bucketing, interpolation — only the color primitives swapped; Oklab-L precomputed in hot loops); migrated 38 themes (PerceptualColor.FromRgb→Color.FromHex).ImGuiPaletteMapperemitscolor.ToSrgbVector4()(consumer-side gamma fix).!= default"not-found" sentinels replaced with aColor?return +is { } colorpattern.AdjustForContrastreaches AA).[major].Verification
dotnet build ThemeProvider.slnclean; 15/15 tests pass. CI on this PR is the authoritative full-branch build+test.29379bd) had a full review confirming the gamma rule is clean and theSemanticColorMapperalgorithm is preserved line-by-line against the original.Notes / follow-ups
CompatibilitySuppressions.xmlbaselines were regenerated for the major break (removed public types). Package-validation/pack runs in CI on merge — if it flags the removed types, the baseline may need a follow-up regeneration with-p:GenerateCompatibilitySuppressionFile=true.priorityLevelslocal inSemanticColorMapper.ktsu.ImGui.Styler(ImGuiApp) to route itsImColoroutput throughktsu.ImGui.Color+ this updated ThemeProvider, once both publish.🤖 Generated with Claude Code