Debian Codegraph @

caca-php/examples/www/colors.php

raw
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 <[email protected]>
12 *
13 * This file is a Php port of "examples/colors.c"
14 * Copyright (c) 2003-2004 Sam Hocevar <[email protected]>
15 * All Rights Reserved
16 *
17 * This program is free software. It comes without any warranty, to
18 * the extent permitted by applicable law. You can redistribute it
19 * and/or modify it under the terms of the Do What the Fuck You Want
20 * to Public License, Version 2, as published by Sam Hocevar. See
21 * http://www.wtfpl.net/ for more details.
22 */
23 ?>
24 <head>
25 <title>display all possible libcaca colour pairs</title>
26 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
27 </head>
28 <body text="silver" bgcolor="black">
29 <?php
30
31 $cv = caca_create_canvas(80, 24);
32 if(!$cv)
33 {
34 die("Failed to create canvas\n");
35 }
36
37 caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK);
38 caca_clear_canvas($cv);
39 for($i = 0; $i < 16; $i++)
40 {
41 caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK);
42 caca_put_str($cv, 3, $i + ($i >= 8 ? 3 : 2), "ANSI " . $i);
43 for($j = 0; $j < 16; $j++)
44 {
45 caca_set_color_ansi($cv, $i, $j);
46 caca_put_str($cv, ($j >= 8 ? 13 : 12) + $j * 4, $i + ($i >= 8 ? 3 : 2),
47 "Aaホ");
48 }
49 }
50
51 caca_set_color_ansi($cv, CACA_LIGHTGRAY, CACA_BLACK);
52 caca_put_str($cv, 3, 20, "This is bold This is blink This is italics This is underline");
53 caca_set_attr($cv, CACA_BOLD);
54 caca_put_str($cv, 3 + 8, 20, "bold");
55 caca_set_attr($cv, CACA_BLINK);
56 caca_put_str($cv, 3 + 24, 20, "blink");
57 caca_set_attr($cv, CACA_ITALICS);
58 caca_put_str($cv, 3 + 41, 20, "italics");
59 caca_set_attr($cv, CACA_UNDERLINE);
60 caca_put_str($cv, 3 + 60, 20, "underline");
61
62 echo caca_export_string($cv, "html3");
63
64 ?>
65 </body>
66 </html>