Secretcolors

Latest version: v1.2.6

Safety actively analyzes 628918 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 2

0.6980392156862745

In the above code, conversion from RGB to HEX and then from HEX to RGB does
not give us the same output. This issue is very typical of any programming
language where we are dealing with float calculations. So you should use
some rounding logic if you want to compare it with original color

In case of conversion to HEX, we usually round the floats to nearest
integers with default `round` function.

However, our benchmarks and testing suggest that these values are accurate
with an error of '0.001'. We also check this during our testings. This much
precision should be good enough for most of the cases. In case, you want even
better precision, we kindly ask you to implement the method by yourself
instead of a depending method provided by `SecretColors`. In future,
we plan to take a look at this in more details. But for now,
the workaround is to make some rounding function like following



python
Use precision for rounding according to your need
def rounded_rgb(*args):
return tuple(round(x,2) for x in args)

0.7

Note: All CIE-XYZ conversion and colorblind simulation functions are still in
beta-testing. Do not use them in your production code

Page 2 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.