Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>Hex Colour Code Generator</title>
- <script type="php">
- <?php function generateRandomString($length = 6) {
- $characters = '0123456789ABCDEF';
- $charactersLength = strlen($characters);
- $randomString = '';
- for ($i = 0; $i < $length; $i++) {
- $randomString .= $characters[rand(0, $charactersLength - 1)];
- }
- return $randomString;
- }
- $hexCode = generateRandomString(); ?>
- </script>
- <style>
- body { background-color: #<?php echo $hexCode; ?>;
- font-family: Arial, Helvetica, sans-serif;
- font-size: 6em;
- color: #FFF;
- padding-left: 40px;
- padding-top: 20px;
- }
- p { padding: 0;
- margin: 0;}
- </style>
- </head>
- <body>
- <p>#<?php echo $hexCode ?></p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement