Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.2 KiB

  1. var assert = require('assert'),
  2. colors = require('../safe');
  3. var s = 'string';
  4. function a(s, code) {
  5. return '\x1B[' + code.toString() + 'm' + s + '\x1B[39m';
  6. }
  7. function aE(s, color, code) {
  8. assert.equal(colors[color](s), a(s, code));
  9. assert.equal(colors.strip(s), s);
  10. }
  11. function h(s, color) {
  12. return '<span style="color:' + color + ';">' + s + '</span>';
  13. }
  14. var stylesColors = ['white', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow'];
  15. var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']);
  16. colors.mode = 'console';
  17. assert.equal(colors.bold(s), '\x1B[1m' + s + '\x1B[22m');
  18. assert.equal(colors.italic(s), '\x1B[3m' + s + '\x1B[23m');
  19. assert.equal(colors.underline(s), '\x1B[4m' + s + '\x1B[24m');
  20. assert.equal(colors.strikethrough(s), '\x1B[9m' + s + '\x1B[29m');
  21. assert.equal(colors.inverse(s), '\x1B[7m' + s + '\x1B[27m');
  22. assert.ok(colors.rainbow);
  23. aE(s, 'white', 37);
  24. aE(s, 'grey', 90);
  25. aE(s, 'black', 30);
  26. aE(s, 'blue', 34);
  27. aE(s, 'cyan', 36);
  28. aE(s, 'green', 32);
  29. aE(s, 'magenta', 35);
  30. aE(s, 'red', 31);
  31. aE(s, 'yellow', 33);
  32. assert.equal(s, 'string');
  33. colors.setTheme({error:'red'});
  34. assert.equal(typeof(colors.red("astring")), 'string');
  35. assert.equal(typeof(colors.error("astring")), 'string');