def apply_alpha(self, background="#000000FF"):

        def tx_alpha(cf, af, cb, ab):
            """Translate the color channel with the alpha channel and background channel color."""

            return round_int(
                abs(
                    cf * (af * RGB_CHANNEL_SCALE) + cb * (ab * RGB_CHANNEL_SCALE) * (1 - (af * RGB_CHANNEL_SCALE))
                )
            ) & 0xFF

        if self.a < 0xFF:
            r, g, b, a = self._split_channels(background)

            self.r = tx_alpha(self.r, self.a, r, a)
            self.g = tx_alpha(self.g, self.a, g, a)
            self.b = tx_alpha(self.b, self.a, b, a)

        return self.get_rgb()
Apply the given transparency with the given background.
dataset/ETHPy150Open facelessuser/ColorHelper/lib/rgba.py/RGBA.apply_alpha