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.

demo.php 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <title>phpColors Demo</title>
  5. <?php
  6. require_once __DIR__ . '/../src/Mexitek/PHPColors/Color.php';
  7. use Mexitek\PHPColors\Color;
  8. // Use different colors to test
  9. $myBlue = new Color("#336699");
  10. $myBlack = new Color("#333");
  11. $myPurple = new Color("#913399");
  12. $myVintage = new Color("#bada55");
  13. // ************** No Need to Change Below **********************
  14. ?>
  15. <style>
  16. .block {
  17. height: 100px;
  18. width: 200px;
  19. font-size: 20px;
  20. text-align: center;
  21. padding-top: 100px;
  22. display: block;
  23. margin: 0;
  24. float: left;
  25. }
  26. .wide-block {
  27. width: 360px;
  28. padding-top: 70px;
  29. padding-left: 20px;
  30. padding-right: 20px;
  31. margin-top: 10px;
  32. }
  33. .clear {
  34. clear: both;
  35. }
  36. .testDiv {
  37. <?= $myBlue->getCssGradient()?>
  38. color: <?=($myBlue->isDark() ? "#EEE":"#333")?>;
  39. }
  40. .testDiv.plain {
  41. background: #<?= $myBlue->getHex()?>;
  42. color: <?=($myBlue->isDark() ? "#EEE":"#333")?>;
  43. }
  44. .testDiv2 {
  45. <?= $myBlack->getCssGradient()?>
  46. color: <?=($myBlack->isDark() ? "#EEE":"#333")?>;
  47. }
  48. .testDiv2.plain {
  49. background: #<?= $myBlack->getHex();?>;
  50. color: <?=($myBlack->isDark() ? "#EEE":"#333")?>;
  51. }
  52. .testDiv3 {
  53. <?= $myPurple->getCssGradient()?>
  54. color: <?=($myPurple->isDark() ? "#EEE":"#333")?>;
  55. }
  56. .testDiv3.plain {
  57. background: #<?= $myPurple->getHex()?>;
  58. color: <?=($myPurple->isDark() ? "#EEE":"#333")?>;
  59. }
  60. .testDiv4 {
  61. <?= $myVintage->getCssGradient(30, true)?>
  62. color: <?=($myVintage->isDark() ? "#EEE":"#333")?>;
  63. }
  64. </style>
  65. </head>
  66. <body>
  67. <div class="clear"></div>
  68. <div class="block testDiv">phpColor Gradient #<?= $myBlue->getHex() ?></div>
  69. <div class="block testDiv plain">Plain #<?= $myBlue->getHex() ?></div>
  70. <div class="clear"></div>
  71. <div class="block testDiv2">phpColor Gradient #<?= $myBlack->getHex() ?></div>
  72. <div class="block testDiv2 plain">Plain #<?= $myBlack->getHex() ?></div>
  73. <div class="clear"></div>
  74. <div class="block testDiv3">phpColor Gradient #<?= $myPurple->getHex() ?></div>
  75. <div class="block testDiv3 plain">Plain #<?= $myPurple->getHex() ?></div>
  76. <div class="clear"></div>
  77. <div class="block wide-block testDiv4">
  78. phpColor Gradient with vintage browsers support #<?= $myVintage->getHex() ?>
  79. </div>
  80. </body>
  81. </html>