nikolaydubina / treemap

🍬 Pretty Treemaps
152 stars 2 forks source link

No RGBA #22

Closed mlange-42 closed 1 year ago

mlange-42 commented 1 year ago

This PR changes SVG generation to use rbg(...) instead of rgba(...), which is not supported by Inkscape.

Alpha is scaled to range [0, 1] and used in the ...-opacity properties.

Alpha can't currently appear when used via the CLI, as it is not supported by the colorful.Hex() function that is used for palettes. Decided to still leave alpha in for use as a library.

Not 100% sure about the bitshift, but it looks like alpha is treated the same as color channels.

Fixes #21

Screenshot Inkscape before:

grafik

After:

grafik

Screen to verify that using fill-opacity and leaving opacity at 1 works:

grafik

codecov[bot] commented 1 year ago

Codecov Report

Base: 53.10% // Head: 52.83% // Decreases project coverage by -0.27% :warning:

Coverage data is based on head (69a0b8f) compared to base (58d62e8). Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #22 +/- ## ========================================== - Coverage 53.10% 52.83% -0.28% ========================================== Files 7 7 Lines 580 583 +3 ========================================== Hits 308 308 - Misses 269 272 +3 Partials 3 3 ``` | [Impacted Files](https://codecov.io/gh/nikolaydubina/treemap/pull/22?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nikolay+Dubina) | Coverage Δ | | |---|---|---| | [render/svg.go](https://codecov.io/gh/nikolaydubina/treemap/pull/22/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nikolay+Dubina#diff-cmVuZGVyL3N2Zy5nbw==) | `0.00% <0.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nikolay+Dubina). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Nikolay+Dubina)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

nikolaydubina commented 1 year ago

thanks! please next time add unit-test and run make docs, so that we regenerate and inspect visually that all works ok!

confirmed all is ok.