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.
 
 
 
 
 
 

67 lines
2.1 KiB

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