Libraryless. Click here for Pure Java version (6436L/41K).
1 | static JTextPane showLineCompedSingleLevelsAsColoredText_v2(LineCompedSingle<Char> lc) { |
2 | // each matrix element is the symbol starting position for the character+1 (or 0 for empty) |
3 | int[][] rows = renderLineCompedSingleLevels_raw_v2(lc); |
4 | S text = uncompressLineCompedSingle(lc); |
5 | printVars(+rows); |
6 | int n = l(first(rows)); |
7 | new L out; |
8 | forEach(rows, row -> { |
9 | var color = Color.white; |
10 | out.add(color); |
11 | var lastSymbol = 0; |
12 | for i to n: { |
13 | if (row[i] == 0) { |
14 | if (color != Color.white) out.add(color = Color.white); |
15 | lastSymbol = 0; |
16 | out.add(' '); |
17 | } else { |
18 | if (row[i] != lastSymbol) { |
19 | color = color == Color.yellow ? Color.blue : Color.yellow; |
20 | out.add(color); |
21 | lastSymbol = row[i]; |
22 | } |
23 | out.add(text.charAt(i)); |
24 | } |
25 | } |
26 | out.add("\n"); |
27 | }); |
28 | ret withTypeWriterFont(showColoredText(out)); |
29 | } |
Began life as a copy of #1031201
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031203 |
Snippet name: | showLineCompedSingleLevelsAsColoredText_v2 |
Eternal ID of this version: | #1031203/5 |
Text MD5: | fc67ab84d5690f0a42235be2ccfc50cc |
Transpilation MD5: | e5d0ec269062b97166f91c11f01d8cc5 |
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:15:17 |
Source code size: | 932 bytes / 29 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 138 / 199 |
Version history: | 4 change(s) |
Referenced in: | [show references] |