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.

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