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.
 
 
 
 
 
 

62 lines
1.4 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_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
  32. cucul_clear_canvas(cv);
  33. for(i = 0; i < 16; i++)
  34. {
  35. cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
  36. cucul_printf(cv, 4, i + (i >= 8 ? 4 : 3), "'%cv': %i (%s)",
  37. 'a' + i, i, cucul_get_color_name(i));
  38. for(j = 0; j < 16; j++)
  39. {
  40. cucul_set_color(cv, i, j);
  41. cucul_putstr(cv, (j >= 8 ? 41 : 40) + j * 2, i + (i >= 8 ? 4 : 3),
  42. "# ");
  43. }
  44. }
  45. caca_refresh_display(dp);
  46. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  47. caca_free_display(dp);
  48. cucul_free_canvas(cv);
  49. return 0;
  50. }