
pixi
Kezdő
|
Hex to RGB színkód konvertáló

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
| [lang:php]
<?php
ob_start();
header("Content-Type: text/html; charset=UTF-8");
echo "<style> input { font: bold 11px arial; background: #FFFFB7; }
#keret{ font: bold 11px arial; border: 1px solid gray; border-radius: 8px; -moz-border-radius: 8px;
-webkit-border-radius: 8px; box-shadow: 8px 8px 20px #888888; }
span { font: bold 11px arial; width: 130px; display: block; background: white; border: 1px solid gray;
border-radius: 4px;}
</style><br>
<CENTER> <br> <h4> hexa => RGB színkód: </h4> <br>";
if(isset($_POST['hex'])) {$hex = $_POST['hex']; } else {$hex = 'FFFFFF';}
$R=hexdec(substr($hex, 0, 2));
$G=hexdec(substr($hex, 2, 2));
$B=hexdec(substr($hex, 4, 2));
$RGB = "($R, $G, $B)";
$hex = strtoupper($hex);
echo "
<TABLE>
<tr> <td id='keret' style='width: 90px;' > #".substr($hex, 0, 2)."0000 </td>
<td id='keret' style='width: 130px; height: 40px; background: #".substr($hex, 0, 2)."0000;'> </td>
<td id='keret' style='width: 170px; height: 80px; background: #$hex;'
rowspan=3><center><span>HEX #$hex <br> RGB ".$RGB."</span></center></td>
</tr>
<tr> <td id='keret' style='width: 90px;' > #00".substr($hex, 2, 2)."00 </td>
<td id='keret' style='width: 130px; height: 40px; background: #00".substr($hex, 2, 2)."00;'> </td>
</tr>
<tr> <td id='keret' style='width: 90px;' > #0000".substr($hex, 4 )." </td>
<td id='keret' style='width: 130px; height: 40px; background: #0000".substr($hex, 4, 2).";'> </td>
</tr>
</TABLE> <br>
<FORM name='val' method='post' action='#'>
hexakód: # <input type='text' size='6' maxlength='6' name='hex' value=".$hex.">
<input id='gombz'type='submit' name='ok' value='ok'>
</FORM> / 0-9, A-B-C-D-E-F / </CENTER>";
ob_end_flush(); ?>
|
Budapest
|

pixi
Kezdő
|

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
| [lang:php]
<?php
ob_start();
header("Content-Type: text/html; charset=UTF-8");
echo "<style> #keret { border-radius: 5px; } </style>";
echo "<CENTER> <br><br> <h3> RGB => hexa színkód: </h3> <br>";
if(isset($_POST['Rsz'])) {$Rsz = $_POST['Rsz']; } else {$Rsz = 255;}
if(isset($_POST['Gsz'])) {$Gsz = $_POST['Gsz']; } else {$Gsz = 255;}
if(isset($_POST['Bsz'])) {$Bsz = $_POST['Bsz']; } else {$Bsz = 255;}
if($Rsz==0) {$hex = "#00";} else {$hex='#'.dechex($Rsz);}
if($Gsz==0) {$hex.='00';} else {$hex.=dechex($Gsz);}
if($Bsz==0) {$hex.='00';} else {$hex.=dechex($Bsz);}
$hex = strtoupper($hex);
echo "<style> input { font: bold 11px arial; background: #FFFFB7; } #keret {font: bold 11px arial; border: 1px solid gray; }
span { font: bold 11px arial; width: 130px; display: block; background: white; border: 1px solid gray; border-radius: 4px; }
</style><br><br>
<TABLE>
<tr><td id='keret' style='width: 90px;' > rgb(".$Rsz.",0,0) </td>
<td id='keret' style='width: 130px; height: 40px; background: rgb(".$Rsz.",0,0);'> </td>
<td id='keret' style='width: 170px; height: 80px; background: rgb($Rsz, $Gsz, $Bsz);'
rowspan=3><center><span> RGB ($Rsz, $Gsz, $Bsz) <br> HEX ".$hex."</span></center></td>
</tr>
<tr><td id='keret' style='width: 90px;' > rgb(0,".$Gsz.",0) </td>
<td id='keret' style='width: 130px; height: 40px; background: rgb(0,".$Gsz.",0);' > </td>
</tr>
<tr> <td id='keret' style='width: 90px;' > rgb(0,0,".$Bsz.") </td>
<td id='keret' style='width: 130px; height: 40px; background: rgb(0,0,".$Bsz.");' > </td>
</tr>
</TABLE> <br>
<FORM name='val' method='post' action='#'>
rgb (<input type='text' size=3 maxlength=3 name='Rsz' value=$Rsz>,
<input type='text' size='3' maxlength='3' name='Gsz' value=$Gsz>,
<input type='text' size='3' maxlength='3' name='Bsz' value=$Bsz>)
<input id='gombz'type='submit' name='ok' value='ok'>
</FORM> 0-255 </CENTER>";
ob_end_flush(); ?> |
Utoljára szerkesztette: pixi 2018.05.29. 14:35
Budapest
|
|