From 5b0c7d7f4e9f06ba6f18f67dcdaaf7369e5c14ea Mon Sep 17 00:00:00 2001 From: CreeperLin Date: Mon, 19 Sep 2022 19:58:07 +0800 Subject: [PATCH] colorize data cells based on byte values --- media/editor/dataDisplay.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/media/editor/dataDisplay.tsx b/media/editor/dataDisplay.tsx index 1dbf7f3..3433b92 100644 --- a/media/editor/dataDisplay.tsx +++ b/media/editor/dataDisplay.tsx @@ -522,6 +522,13 @@ const DataCell: React.FC<{ onMouseLeave={onMouseLeave} onKeyDown={onKeyDown} data-key={focusedElement.key} + style={isChar ? {} : { + backgroundColor: `rgba(\ + ${(((value & 0xe0) >> 5) / ((1 << 3) - 1) * 0xff) | 0},\ + ${(((value & 0x1c) >> 2) / ((1 << 3) - 1) * 0xff) | 0},\ + ${((value & 0x3) / ((1 << 2) - 1) * 0xff) | 0},\ + 0.5)` + }} >{firstOctetOfEdit !== undefined ? firstOctetOfEdit.toString(16).toUpperCase() : children}