:right-sidebar: True Color =================================================================== .. currentmodule:: gi.repository.Pango .. class:: Color(*args, **kwargs) :no-contents-entry: :Constructors: :: Color() Methods ------- .. rst-class:: interim-class .. class:: Color :no-index: .. method:: free() -> None Frees a color allocated by :obj:`~gi.repository.Pango.Color.copy`. .. method:: parse(spec: str) -> bool Fill in the fields of a color from a string specification. The string can either one of a large set of standard names. (Taken from the CSS Color `specification `_, or it can be a value in the form ````rgb````, ````rrggbb````, ````rrrgggbbb```` or ````rrrrggggbbbb````, where ``r``, ``g`` and ``b`` are hex digits of the red, green, and blue components of the color, respectively. (White in the four forms is ````fff````, ````ffffff````, ````fffffffff```` and ````ffffffffffff````.) :param spec: a string specifying the new color .. method:: parse_with_alpha(spec: str) -> tuple[bool, int] Fill in the fields of a color from a string specification. The string can either one of a large set of standard names. (Taken from the CSS Color `specification `_, or it can be a hexadecimal value in the form ````rgb````, ````rrggbb````, ````rrrgggbbb```` or ````rrrrggggbbbb```` where ``r``, ``g`` and ``b`` are hex digits of the red, green, and blue components of the color, respectively. (White in the four forms is ````fff````, ````ffffff````, ````fffffffff```` and ````ffffffffffff````.) Additionally, parse strings of the form ````rgba````, ````rrggbbaa````, ````rrrrggggbbbbaaaa````, if ``alpha`` is not :const:`None`, and set ``alpha`` to the value specified by the hex digits for ``a``. If no alpha component is found in ``spec``, ``alpha`` is set to 0xffff (for a solid color). .. versionadded:: 1.46 :param spec: a string specifying the new color .. method:: to_string() -> str Returns a textual specification of ``color``. The string is in the hexadecimal form ````rrrrggggbbbb````, where ``r``, ``g`` and ``b`` are hex digits representing the red, green, and blue components respectively. .. versionadded:: 1.16 Fields ------ .. rst-class:: interim-class .. class:: Color :no-index: .. attribute:: blue Value of blue component .. attribute:: green Value of green component .. attribute:: red Value of red component