1 | <?php |
---|
2 | header('Content-Type: text/html; charset=UTF-8'); |
---|
3 | ?> |
---|
4 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
5 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
6 | |
---|
7 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
---|
8 | <?php |
---|
9 | /* |
---|
10 | * colors display all possible libcaca colour pairs |
---|
11 | * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> |
---|
12 | * |
---|
13 | * This file is a Php port of "examples/colors.c" |
---|
14 | * Copyright (c) 2003-2004 Sam Hocevar <sam@zoy.org> |
---|
15 | * All Rights Reserved |
---|
16 | * |
---|
17 | * $Id: colors.php 3261 2008-11-04 00:41:56Z bsittler $ |
---|
18 | * |
---|
19 | * This program is free software. It comes without any warranty, to |
---|
20 | * the extent permitted by applicable law. You can redistribute it |
---|
21 | * and/or modify it under the terms of the Do What The Fuck You Want |
---|
22 | * To Public License, Version 2, as published by Sam Hocevar. See |
---|
23 | * http://sam.zoy.org/wtfpl/COPYING for more details. |
---|
24 | */ |
---|
25 | ?> |
---|
26 | <head> |
---|
27 | <title>display all possible libcaca colour pairs</title> |
---|
28 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
---|
29 | </head> |
---|
30 | <body text="silver" bgcolor="black"> |
---|
31 | <?php |
---|
32 | |
---|
33 | $cv = caca_create_canvas(80, 24); |
---|
34 | if(!$cv) |
---|
35 | { |
---|
36 | die("Failed to create canvas\n"); |
---|
37 | } |
---|
38 | |
---|
39 | caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); |
---|
40 | caca_clear_canvas($cv); |
---|
41 | for($i = 0; $i < 16; $i++) |
---|
42 | { |
---|
43 | caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); |
---|
44 | caca_put_str($cv, 3, $i + ($i >= 8 ? 3 : 2), "ANSI " . $i); |
---|
45 | for($j = 0; $j < 16; $j++) |
---|
46 | { |
---|
47 | caca_set_color_ansi($cv, $i, $j); |
---|
48 | caca_put_str($cv, ($j >= 8 ? 13 : 12) + $j * 4, $i + ($i >= 8 ? 3 : 2), |
---|
49 | "Aaホ"); |
---|
50 | } |
---|
51 | } |
---|
52 | |
---|
53 | caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK); |
---|
54 | caca_put_str($cv, 3, 20, "This is bold This is blink This is italics This is underline"); |
---|
55 | caca_set_attr($cv, CACA_BOLD); |
---|
56 | caca_put_str($cv, 3 + 8, 20, "bold"); |
---|
57 | caca_set_attr($cv, CACA_BLINK); |
---|
58 | caca_put_str($cv, 3 + 24, 20, "blink"); |
---|
59 | caca_set_attr($cv, CACA_ITALICS); |
---|
60 | caca_put_str($cv, 3 + 41, 20, "italics"); |
---|
61 | caca_set_attr($cv, CACA_UNDERLINE); |
---|
62 | caca_put_str($cv, 3 + 60, 20, "underline"); |
---|
63 | |
---|
64 | echo caca_export_string($cv, "html3"); |
---|
65 | |
---|
66 | ?> |
---|
67 | </body> |
---|
68 | </html> |
---|