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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. int i, j;
  24. qq = cucul_create(0, 0);
  25. if(!qq)
  26. return 1;
  27. kk = caca_attach(qq);
  28. if(!kk)
  29. return 1;
  30. cucul_clear(qq);
  31. for(i = 0; i < 16; i++)
  32. {
  33. cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
  34. cucul_printf(qq, 4, i + (i >= 8 ? 4 : 3), "'%c': %i (%s)",
  35. 'a' + i, i, cucul_get_color_name(i));
  36. for(j = 0; j < 16; j++)
  37. {
  38. cucul_set_color(qq, i, j);
  39. cucul_putstr(qq, (j >= 8 ? 41 : 40) + j * 2, i + (i >= 8 ? 4 : 3),
  40. "# ");
  41. }
  42. }
  43. caca_display(kk);
  44. caca_wait_event(kk, CACA_EVENT_KEY_PRESS);
  45. caca_detach(kk);
  46. cucul_free(qq);
  47. return 0;
  48. }