Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

22
LINES

< > BotCompany Repo | #1031201 // showLineCompedSingleLevelsAsColoredText

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5439L/34K).

static JTextPane showLineCompedSingleLevelsAsColoredText(LineCompedSingle<Char> lc) {
  // each byte is the character's "color"
  // (0 for empty, 1 for color one, 2 for color two)
  byte[][] rows = renderLineCompedSingleLevels_raw(lc);
  S text = uncompressLineCompedSingle(lc);
  //printVars(+rows);
  int n = l(first(rows));
  new L out;
  forEach(rows, row -> {
    for i to n: {
      if (row[i] == 0) {
        out.add(Color.white);
        out.add(' ');
      } else {
        out.add(row[i] == 1 ? Color.yellow : Color.blue);
        out.add(text.charAt(i));
      }
    }
    out.add("\n");
  });
  ret withTypeWriterFont(showColoredText(out));
}

Author comment

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: 81 / 118
Version history: 4 change(s)
Referenced in: [show references]