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

Last change on this file since 350 was 350, checked in by Sam Hocevar, 17 years ago
  • test/colors.c: + Extracted the colour test from examples/demo.c.
  • Property svn:keywords set to Id
File size: 1.5 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 350 2004-01-14 10:32:04Z sam $
7 *
8 *  This program is free software; you can redistribute it and/or
9 *  modify it under the terms of the GNU Lesser General Public
10 *  License as published by the Free Software Foundation; either
11 *  version 2 of the License, or (at your option) any later version.
12 *
13 *  This program is distributed in the hope that it will be useful,
14 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 *  Lesser General Public License for more details.
17 *
18 *  You should have received a copy of the GNU Lesser General Public
19 *  License along with this program; if not, write to the Free Software
20 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 *  02111-1307  USA
22 */
23
24#include "config.h"
25
26#include <stdio.h>
27
28#include "caca.h"
29
30int main(int argc, char **argv)
31{
32    int i, j;
33
34    if(caca_init())
35        return 1;
36
37    caca_clear();
38    for(i = 0; i < 16; i++)
39    {
40        caca_set_color(CACA_COLOR_LIGHTGRAY, CACA_COLOR_BLACK);
41        caca_printf(4, i + (i >= 8 ? 4 : 3), "'%c': %i (%s)",
42                    'a' + i, i, caca_get_color_name(i));
43        for(j = 0; j < 16; j++)
44        {
45            caca_set_color(i, j);
46            caca_putstr((j >= 8 ? 41 : 40) + j * 2, i + (i >= 8 ? 4 : 3), "# ");
47        }
48    }
49
50    caca_refresh();
51    caca_wait_event(CACA_EVENT_KEY_PRESS);
52    caca_end();
53
54    return 0;
55}
56
Note: See TracBrowser for help on using the repository browser.