Libraryless. Click here for Pure Java version (5439L/34K).
1 | static JTextPane showLineCompedSingleLevelsAsColoredText(LineCompedSingle<Char> lc) {
|
2 | // each byte is the character's "color" |
3 | // (0 for empty, 1 for color one, 2 for color two) |
4 | byte[][] rows = renderLineCompedSingleLevels_raw(lc); |
5 | S text = uncompressLineCompedSingle(lc); |
6 | //printVars(+rows); |
7 | int n = l(first(rows)); |
8 | new L out; |
9 | forEach(rows, row -> {
|
10 | for i to n: {
|
11 | if (row[i] == 0) {
|
12 | out.add(Color.white); |
13 | out.add(' ');
|
14 | } else {
|
15 | out.add(row[i] == 1 ? Color.yellow : Color.blue); |
16 | out.add(text.charAt(i)); |
17 | } |
18 | } |
19 | out.add("\n");
|
20 | }); |
21 | ret withTypeWriterFont(showColoredText(out)); |
22 | } |
Began life as a copy of #1031198
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1031201 |
| Snippet name: | showLineCompedSingleLevelsAsColoredText |
| Eternal ID of this version: | #1031201/5 |
| Text MD5: | 249af3ed8a65a5ebf767f2aaca300df7 |
| Transpilation MD5: | f066a5f3ba5f1e671b6549b5d30aa9ab |
| 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:02:44 |
| Source code size: | 678 bytes / 22 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 361 / 457 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |