feat: add LT_HEX(0xRRGGBB) color-packing macro#57
Merged
Conversation
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
Add a public
LT_HEX(0xRRGGBB)macro that packs a hex color into bits 0–23 of anlt_attr, complementing the existingLT_RGB(r,g,b).Changes
LT_HEX(rgb)macro ininclude/libterm/libterm.hbesideLT_RGB, masking to0xFFFFFFuso attribute/LT_HI_BLACKhigh bits can never leak. Addtests/test_color_macros.c(compile-time_Static_assertchecks for packing parity, masking, and default/black semantics) and register it in CTest.LT_HEXin the ROADMAP color row and add a CHANGELOG[Unreleased]entry.Testing
cmake --build build→ exit 0ctest --test-dir build→ 100% tests passed, 0 failed out of 38 (incl.test_color_macros)clang-format --dry-run --Werror(v22.1.6) → cleanNotes
LT_HEX(0xRRGGBB)packs the same bits asLT_RGB(0xRR, 0xGG, 0xBB); a packed0means terminal-default (OR inLT_HI_BLACKfor real black), matchingLT_RGBsemantics.