Color class

Color class

The structure representing a color.

The Color type exposes the following members:

Methods

Method Description
equals Determines whether the specified Color structure is equivalent to this Color structure.
equals Determines whether the specified object is a Color structure and is equivalent to this Color structure.
equals_color
equals_object
from_argb Creates a Color structure from a 32-bit ARGB value.
from_argb Creates a Color structure from the specified base Color but with a new alpha value.
from_argb Creates a Color structure from the specified 8‑bit red, green, and blue values; the alpha component is implicitly set to 255 (fully opaque).
from_argb Creates a Color structure from the four ARGB component (alpha, red, green, and blue) values.
from_argb_int32
get_brightness Gets the hue‑saturation‑brightness (HSB) brightness value for this Color structure.
get_hash_code Returns a hash code for this Color structure.
get_hue Gets the hue-saturation-brightness (HSB) hue value, in degrees, for this Color structure.
get_saturation Gets the hue‑saturation‑brightness (HSB) saturation value for this Color structure.
to_argb Gets the 32-bit ARGB value of this Color structure.

Properties

Property Description
a The alpha component of the color, with valid values from 0 to 255.
b The blue component of the color.
g The green component of the color, with valid values from 0 through 255.
is_empty The property returns True if this color is uninitialized; otherwise, False.
r The red component of the color. Valid values are 0 through 255.

Fields

Field Description
EMPTY Gets a system-defined color.
TRANSPARENT Gets a system-defined color.
ALICE_BLUE Gets a system-defined color.
ANTIQUE_WHITE Gets a system-defined color.
AQUA Gets a system-defined color.
AQUAMARINE Gets a system-defined color.
AZURE Gets a system-defined color.
BEIGE Gets a system-defined color.
BISQUE Gets a system-defined color.
BLACK Gets a system-defined color.
BLANCHED_ALMOND Gets a system-defined color.
BLUE Gets a system-defined color.
BLUE_VIOLET Gets a system-defined color.
BROWN Gets a system-defined color.
BURLY_WOOD Gets a system-defined color.
CADET_BLUE Gets a system-defined color.
CHARTREUSE Gets a system-defined color.
CHOCOLATE Gets a system-defined color.
CORAL Gets a system-defined color.
CORNFLOWER_BLUE Gets a system-defined color.
CORNSILK Gets a system-defined color.
CRIMSON Gets a system-defined color.
CYAN Gets a system-defined color.
DARK_BLUE Gets a system-defined color.
DARK_CYAN Gets a system-defined color.
DARK_GOLDENROD Gets a system-defined color.
DARK_GRAY Gets a system-defined color.
DARK_GREEN Gets a system-defined color.
DARK_KHAKI Gets a system-defined color.
DARK_MAGENTA Gets a system-defined color.
DARK_OLIVE_GREEN Gets a system-defined color.
DARK_ORANGE Gets a system-defined color.
DARK_ORCHID Gets a system-defined color.
DARK_RED Gets a system-defined color.
DARK_SALMON Gets a system-defined color.
DARK_SEA_GREEN Gets a system-defined color.
DARK_SLATE_BLUE Gets a system-defined color.
DARK_SLATE_GRAY Gets a system-defined color.
DARK_TURQUOISE Gets a system-defined color.
DARK_VIOLET Gets a system-defined color.
DEEP_PINK Gets a system-defined color.
DEEP_SKY_BLUE Gets a system-defined color.
DIM_GRAY Gets a system-defined color.
DODGER_BLUE Gets a system-defined color.
FIREBRICK Gets a system-defined color.
FLORAL_WHITE Gets a system-defined color.
FOREST_GREEN Gets a system-defined color.
FUCHSIA Gets a system-defined color.
GAINSBORO Gets a system-defined color.
GHOST_WHITE Gets a system-defined color.
GOLD Gets a system-defined color.
GOLDENROD Gets a system-defined color.
GRAY Gets a system-defined color.
GREEN Gets a system-defined color.
GREEN_YELLOW Gets a system-defined color.
HONEYDEW Gets a system-defined color.
HOT_PINK Gets a system-defined color.
INDIAN_RED Gets a system-defined color.
INDIGO Gets a system-defined color.
IVORY Gets a system-defined color.
KHAKI Gets a system-defined color.
LAVENDER Gets a system-defined color.
LAVENDER_BLUSH Gets a system-defined color.
LAWN_GREEN Gets a system-defined color.
LEMON_CHIFFON Gets a system-defined color.
LIGHT_BLUE Gets a system-defined color.
LIGHT_CORAL Gets a system-defined color.
LIGHT_CYAN Gets a system-defined color.
LIGHT_GOLDENROD_YELLOW Gets a system-defined color.
LIGHT_GRAY Gets a system-defined color.
LIGHT_GREEN Gets a system-defined color.
LIGHT_PINK Gets a system-defined color.
LIGHT_SALMON Gets a system-defined color.
LIGHT_SEA_GREEN Gets a system-defined color.
LIGHT_SKY_BLUE Gets a system-defined color.
LIGHT_SLATE_GRAY Gets a system-defined color.
LIGHT_STEEL_BLUE Gets a system-defined color.
LIGHT_YELLOW Gets a system-defined color.
LIME Gets a system-defined color.
LIME_GREEN Gets a system-defined color.
LINEN Gets a system-defined color.
MAGENTA Gets a system-defined color.
MAROON Gets a system-defined color.
MEDIUM_AQUAMARINE Gets a system-defined color.
MEDIUM_BLUE Gets a system-defined color.
MEDIUM_ORCHID Gets a system-defined color.
MEDIUM_PURPLE Gets a system-defined color.
MEDIUM_SEA_GREEN Gets a system-defined color.
MEDIUM_SLATE_BLUE Gets a system-defined color.
MEDIUM_SPRING_GREEN Gets a system-defined color.
MEDIUM_TURQUOISE Gets a system-defined color.
MEDIUM_VIOLET_RED Gets a system-defined color.
MIDNIGHT_BLUE Gets a system-defined color.
MINT_CREAM Gets a system-defined color.
MISTY_ROSE Gets a system-defined color.
MOCCASIN Gets a system-defined color.
NAVAJO_WHITE Gets a system-defined color.
NAVY Gets a system-defined color.
OLD_LACE Gets a system-defined color.
OLIVE Gets a system-defined color.
OLIVE_DRAB Gets a system-defined color.
ORANGE Gets a system-defined color.
ORANGE_RED Gets a system-defined color.
ORCHID Gets a system-defined color.
PALE_GOLDENROD Gets a system-defined color.
PALE_GREEN Gets a system-defined color.
PALE_TURQUOISE Gets a system-defined color.
PALE_VIOLET_RED Gets a system-defined color.
PAPAYA_WHIP Gets a system-defined color.
PEACH_PUFF Gets a system-defined color.
PERU Gets a system-defined color.
PINK Gets a system-defined color.
PLUM Gets a system-defined color.
POWDER_BLUE Gets a system-defined color.
PURPLE Gets a system-defined color.
RED Gets a system-defined color.
ROSY_BROWN Gets a system-defined color.
ROYAL_BLUE Gets a system-defined color.
SADDLE_BROWN Gets a system-defined color.
SALMON Gets a system-defined color.
SANDY_BROWN Gets a system-defined color.
SEA_GREEN Gets a system-defined color.
SEA_SHELL Gets a system-defined color.
SIENNA Gets a system-defined color.
SILVER Gets a system-defined color.
SKY_BLUE Gets a system-defined color.
SLATE_BLUE Gets a system-defined color.
SLATE_GRAY Gets a system-defined color.
SNOW Gets a system-defined color.
SPRING_GREEN Gets a system-defined color.
STEEL_BLUE Gets a system-defined color.
TAN Gets a system-defined color.
TEAL Gets a system-defined color.
THISTLE Gets a system-defined color.
TOMATO Gets a system-defined color.
TURQUOISE Gets a system-defined color.
VIOLET Gets a system-defined color.
WHEAT Gets a system-defined color.
WHITE Gets a system-defined color.
WHITE_SMOKE Gets a system-defined color.
YELLOW Gets a system-defined color.
YELLOW_GREEN Gets a system-defined color.

Example

from groupdocs.watermark import Watermarker
from groupdocs.watermark.watermarks import TextWatermark, Font, Color

with Watermarker("document.pdf") as watermarker:
    watermark = TextWatermark("CONFIDENTIAL", Font("Arial", 48))
    watermark.foreground_color = Color.red
    watermarker.add(watermark)
    watermarker.save("watermarked.pdf")

Guides

Task guides that use Color:

See Also