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.
 
 
 
 
 
 

73 lines
2.0 KiB

  1. /*
  2. * colors display all possible libcaca colour pairs
  3. * Copyright (c) 2003-2004 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the Do What The Fuck You Want To
  10. * Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. #include "config.h"
  14. #include "common.h"
  15. #if !defined(__KERNEL__)
  16. # include <stdio.h>
  17. #endif
  18. #include "cucul.h"
  19. #include "caca.h"
  20. int main(int argc, char **argv)
  21. {
  22. cucul_canvas_t *cv;
  23. caca_display_t *dp;
  24. int i, j;
  25. cv = cucul_create_canvas(0, 0);
  26. if(!cv)
  27. return 1;
  28. dp = caca_create_display(cv);
  29. if(!dp)
  30. return 1;
  31. cucul_set_attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));
  32. cucul_clear_canvas(cv);
  33. for(i = 0; i < 16; i++)
  34. {
  35. cucul_set_attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));
  36. cucul_printf(cv, 3, i + (i >= 8 ? 3 : 2), "'%cv': %i (%s)",
  37. 'a' + i, i, cucul_get_color_name(i));
  38. for(j = 0; j < 16; j++)
  39. {
  40. cucul_set_attr(cv, cucul_ansi_to_attr(i, j));
  41. cucul_putstr(cv, (j >= 8 ? 40 : 39) + j * 2, i + (i >= 8 ? 3 : 2),
  42. "Aa");
  43. }
  44. }
  45. cucul_set_attr(cv, cucul_ansi_to_attr(CUCUL_LIGHTGRAY, CUCUL_BLACK));
  46. cucul_putstr(cv, 3, 20, "This is bold This is blink This is italics This is underline");
  47. cucul_set_attr(cv, CUCUL_BOLD);
  48. cucul_putstr(cv, 3 + 8, 20, "bold");
  49. cucul_set_attr(cv, CUCUL_BLINK);
  50. cucul_putstr(cv, 3 + 24, 20, "blink");
  51. cucul_set_attr(cv, CUCUL_ITALICS);
  52. cucul_putstr(cv, 3 + 41, 20, "italics");
  53. cucul_set_attr(cv, CUCUL_UNDERLINE);
  54. cucul_putstr(cv, 3 + 60, 20, "underline");
  55. caca_refresh_display(dp);
  56. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  57. caca_free_display(dp);
  58. cucul_free_canvas(cv);
  59. return 0;
  60. }