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.

colors.c 1.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. #if !defined(__KERNEL__)
  15. # include <stdio.h>
  16. #endif
  17. #include "cucul.h"
  18. #include "caca.h"
  19. int main(int argc, char **argv)
  20. {
  21. cucul_t *qq;
  22. caca_t *kk;
  23. caca_event_t ev;
  24. int i, j;
  25. qq = cucul_create(0, 0);
  26. if(!qq)
  27. return 1;
  28. kk = caca_attach(qq);
  29. if(!kk)
  30. return 1;
  31. cucul_clear(qq);
  32. for(i = 0; i < 16; i++)
  33. {
  34. cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
  35. cucul_printf(qq, 4, i + (i >= 8 ? 4 : 3), "'%c': %i (%s)",
  36. 'a' + i, i, cucul_get_color_name(i));
  37. for(j = 0; j < 16; j++)
  38. {
  39. cucul_set_color(qq, i, j);
  40. cucul_putstr(qq, (j >= 8 ? 41 : 40) + j * 2, i + (i >= 8 ? 4 : 3),
  41. "# ");
  42. }
  43. }
  44. caca_display(kk);
  45. caca_get_event(kk, CACA_EVENT_KEY_PRESS, &ev, -1);
  46. caca_detach(kk);
  47. cucul_free(qq);
  48. return 0;
  49. }