-
-
Notifications
You must be signed in to change notification settings - Fork 0
Show colorized items #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify the luminance calculation weights.
The contrast calculation uses non-standard luminance weights. Consider using ITU-R BT.709 standard weights for more accurate perceptual luminance.
The current weights (1063, 3576, 361) don't match standard RGB-to-luminance coefficients. Standard weights are approximately (2990, 5870, 1140) when scaled to avoid floating-point arithmetic. Please verify if these custom weights are intentional or if they should be updated to standard values.
🌐 Web query:
💡 Result:
ITU-R BT.709 defines specific coefficients for converting RGB values to luminance (Y'). According to the standard, the RGB to luminance conversion coefficients are:
These coefficients are used in the following formula to derive the luminance signal:
Y' = 0.2126 × R' + 0.7152 × G' + 0.0722 × B'[4][5]
Where R', G', and B' represent the gamma-corrected (non-linear) RGB values.
The BT.709 coefficients differ from those used in other standards like Rec.601/BT.601, which uses 0.299 for red, 0.587 for green, and 0.114 for blue[7]. This difference is significant because the BT.709 coefficients are designed to match the primaries and white points of HDTV systems, allowing luma to correspond more closely to actual luminance[8].
For the constant luminance version (YC') specified in BT.2020, slightly different coefficients are used:
The BT.709 standard is primarily used for HDTV applications and has become the basis for many modern video formats and color space conversions.
Citations:
Use ITU-R BT.709 Luminance Weights for Contrast
The
_altColorfunction currently applies custom weights(1063, 3576, 361)which don’t align with BT.709’s perceptual luminance coefficients. Update to the standard values and adjust the threshold accordingly.• File:
src/Data/Hashable/Color.hsLines: 56–59
Suggested diff:
• New threshold
400000preserves the original 15.7% luminance cutoff (200 000/1 275 000 ≈ 0.157 → 0.157×2 550 000 ≈ 400 000).This ensures more accurate, standard-compliant contrast decisions.
📝 Committable suggestion
🤖 Prompt for AI Agents