Coloring With Hsl With My Php Code
i am trying to learn php as i Study genetics and this would be useful for bioinformatics. I am having trouble with my code and im sure its something very stupid but i cant see a s
Solution 1:
You might want to use the <span>
HTML tag instead of <div>
.
Because each <div>
is normally displayed by browsers with a line-break above and below.
Alternatively you can define how <div>
should look like with CSS, but I think that's too much for the moment:
div {display: inline;}
Example with the <span>
HTML element and using substr
(I might be off by one or so, I assume you can fix that):
$truecol = 'hsl(0,100%,50%)';
colorSequence($seq, 5, $truecol, 3);
function colorSequence ($seq, $position, $truecol, $TFBSlength)
{
$before = substr($seq, 0, $position);
$color = substr($seq, $position, $TFBSlength);
$after = substr($seq, $position + $TFBSLength);
printf("%s<span style=\"color: %s;\">%s</span>%s\n",
$before, $truecol, $color, $after);
}
Post a Comment for "Coloring With Hsl With My Php Code"