Skip to content

feat: add LT_HEX(0xRRGGBB) color-packing macro#57

Merged
rizukirr merged 4 commits into
mainfrom
feat/lt-hex-macro
Jun 14, 2026
Merged

feat: add LT_HEX(0xRRGGBB) color-packing macro#57
rizukirr merged 4 commits into
mainfrom
feat/lt-hex-macro

Conversation

@rizukirr

Copy link
Copy Markdown
Owner

Summary

Add a public LT_HEX(0xRRGGBB) macro that packs a hex color into bits 0–23 of an lt_attr, complementing the existing LT_RGB(r,g,b).

Changes

  • Add LT_HEX(rgb) macro in include/libterm/libterm.h beside LT_RGB, masking to 0xFFFFFFu so attribute/LT_HI_BLACK high bits can never leak. Add tests/test_color_macros.c (compile-time _Static_assert checks for packing parity, masking, and default/black semantics) and register it in CTest.
  • Note LT_HEX in the ROADMAP color row and add a CHANGELOG [Unreleased] entry.

Testing

  • cmake --build build → exit 0
  • ctest --test-dir build → 100% tests passed, 0 failed out of 38 (incl. test_color_macros)
  • clang-format --dry-run --Werror (v22.1.6) → clean

Notes

  • LT_HEX(0xRRGGBB) packs the same bits as LT_RGB(0xRR, 0xGG, 0xBB); a packed 0 means terminal-default (OR in LT_HI_BLACK for real black), matching LT_RGB semantics.
  • No termbox2-compat alias (upstream has none); no changes to SGR emission.

@rizukirr rizukirr merged commit 0e963b9 into main Jun 14, 2026
21 checks passed
@rizukirr rizukirr deleted the feat/lt-hex-macro branch June 16, 2026 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant