Libraryless. Click here for Pure Java version (4144L/26K).
// result can be used in coloredTextToTextPane static L lineCompedSingleLevelsAsColoredText(LineCompedSingle<Char> lc) { // each matrix element is the symbol starting position for the character+1 (or 0 for empty) int[][] rows = renderLineCompedSingleLevels_raw_v2(lc); S text = uncompressLineCompedSingle(lc); printVars(+rows); int n = l(first(rows)); new L out; forEach(rows, row -> { var color = Color.white; out.add(color); var lastSymbol = 0; for i to n: { if (row[i] == 0) { if (color != Color.white) out.add(color = Color.white); lastSymbol = 0; out.add(' '); } else { if (row[i] != lastSymbol) { color = color == Color.yellow ? lightBlue() : Color.yellow; out.add(color); lastSymbol = row[i]; } out.add(text.charAt(i)); } } out.add("\n"); }); ret out; }
Began life as a copy of #1031203
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031206 |
Snippet name: | lineCompedSingleLevelsAsColoredText |
Eternal ID of this version: | #1031206/3 |
Text MD5: | 3c4a4afde7c82925104c3f0c8b428b3b |
Transpilation MD5: | cc78c266768bfb65676427acc99a2f28 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-05-20 15:28:22 |
Source code size: | 929 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 121 / 193 |
Version history: | 2 change(s) |
Referenced in: | [show references] |