source: libcaca/trunk/test/colors.c @ 522

Last change on this file since 522 was 522, checked in by Sam Hocevar, 15 years ago
  • Changed the licensing to WTFPL, as per all copyright holders' permission.
  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
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: colors.c 522 2006-03-04 00:35:45Z sam $
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
14#include "config.h"
15
16#include <stdio.h>
17
18#include "caca.h"
19
20int main(int argc, char **argv)
21{
22    int i, j;
23
24    if(caca_init())
25        return 1;
26
27    caca_clear();
28    for(i = 0; i < 16; i++)
29    {
30        caca_set_color(CACA_COLOR_LIGHTGRAY, CACA_COLOR_BLACK);
31        caca_printf(4, i + (i >= 8 ? 4 : 3), "'%c': %i (%s)",
32                    'a' + i, i, caca_get_color_name(i));
33        for(j = 0; j < 16; j++)
34        {
35            caca_set_color(i, j);
36            caca_putstr((j >= 8 ? 41 : 40) + j * 2, i + (i >= 8 ? 4 : 3), "# ");
37        }
38    }
39
40    caca_refresh();
41    caca_wait_event(CACA_EVENT_KEY_PRESS);
42    caca_end();
43
44    return 0;
45}
46
Note: See TracBrowser for help on using the repository browser.