Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: rgba with alpha channel to any color conversion works, but neither hexa nor hsla #48

Open
NikarashiHatsu opened this issue Oct 6, 2023 · 0 comments

Comments

@NikarashiHatsu
Copy link
Contributor

This issue is pretty much straightforward, to give you a picture of what went wrong, here I listed all of my issues

[WORKING] Rgba with opacity to any color conversion:

<?php

use OzdemirBurak\Iris\Color\Rgba;

$color = new Rgba('rgba(239, 68, 68, 0.5)');

?>

<div style="width: 200px; margin-bottom: 16px;">
    <?= print_r($color) ?>
</div>

<div style="display: flex;">
    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toHex() ?>; margin-right: 10px;">
        <?= $color->toHex() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toHexa() ?>; margin-right: 10px;">
        <?= $color->toHexa() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toHsl() ?>; margin-right: 10px;">
        <?= $color->toHsl() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toHsla() ?>; margin-right: 10px;">
        <?= $color->toHsla() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toRgb() ?>; margin-right: 10px;">
        <?= $color->toRgb() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toRgba() ?>;">
        <?= $color->toRgba() ?>
    </div>
</div>
Screenshot 2023-10-06 at 13 38 36

[Buggy] Hsla with opacity color conversion:

<?php

use OzdemirBurak\Iris\Color\Hsla;

$color = new Hsla('hsla(150,100%,50%,0.7)');

?>

<div style="width: 200px; margin-bottom: 16px;">
    <?= print_r($color) ?>
</div>

<div style="display: flex;">
    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toHex() ?>; margin-right: 10px;">
        <?= $color->toHex() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toHexa() ?>; margin-right: 10px;">
        <?= $color->toHexa() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toHsl() ?>; margin-right: 10px;">
        <?= $color->toHsl() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toHsla() ?>; margin-right: 10px;">
        <?= $color->toHsla() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toRgb() ?>; margin-right: 10px;">
        <?= $color->toRgb() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toRgba() ?>;">
        <?= $color->toRgba() ?>
    </div>
</div>
Screenshot 2023-10-06 at 13 38 43

[Buggy] Hexa with opacity color conversion

<?php

use OzdemirBurak\Iris\Color\Hexa;

$color = new Hexa('#d946ef88');

?>

<div style="width: 200px; margin-bottom: 16px;">
    <?= print_r($color) ?>
</div>

<div style="display: flex;">
    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toHex() ?>; margin-right: 10px;">
        <?= $color->toHex() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toHexa() ?>; margin-right: 10px;">
        <?= $color->toHexa() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toHsl() ?>; margin-right: 10px;">
        <?= $color->toHsl() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toHsla() ?>; margin-right: 10px;">
        <?= $color->toHsla() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toRgb() ?>; margin-right: 10px;">
        <?= $color->toRgb() ?>
    </div>

    <div style="width: 100px; height: 100px; padding: 16px; word-wrap: break-word; background-color: <?= $color->toRgba() ?>;">
        <?= $color->toRgba() ?>
    </div>
</div>
Screenshot 2023-10-06 at 13 38 50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants