<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">from . import Utility
from . import Color


class Fill(object):
    __slots__ = ("_background", "id")

    def __init__(self, background=None):
        self._background = background

    @property
    def background(self):
        return Utility.lazy_get(self, "_background", Color.Color())

    @background.setter
    def background(self, value):
        Utility.lazy_set(self, "_background", None, value)

    @property
    def is_default(self):
        return self == Fill()

    def __eq__(self, other):
        if other is None:
            return self.is_default
        return self._background == other._background

    def __hash__(self):
        return hash(self.background)

    def get_xml_string(self):
        if not self.background:
            return '&lt;fill&gt;&lt;patternFill patternType="none"/&gt;&lt;/fill&gt;'
        else:
            return (
                '&lt;fill&gt;&lt;patternFill patternType="solid"&gt;&lt;fgColor rgb="%s"/&gt;&lt;/patternFill&gt;&lt;/fill&gt;'
                % self.background.hex
            )

    def __or__(self, other):
        return Fill(
            background=Utility.nonboolean_or(self._background, other._background, None)
        )

    def __and__(self, other):
        return Fill(
            background=Utility.nonboolean_and(self._background, other._background, None)
        )

    def __xor__(self, other):
        return Fill(
            background=Utility.nonboolean_xor(self._background, other._background, None)
        )

    def __str__(self):
        return "Fill: #%s" % self.background.hex

    def __repr__(self):
        return "&lt;%s&gt;" % self.__str__()
</pre></body></html>